linux/drivers/block/drbd
Lars Ellenberg 1b6f19740d drbd: fix access of unallocated pages and kernel panic
BUG: unable to handle kernel NULL pointer dereference at (null)
...
 [<d1e17561>] ? _drbd_bm_set_bits+0x151/0x240 [drbd]
 [<d1e236f8>] ? receive_bitmap+0x4f8/0xbc0 [drbd]

This fixes an off-by-one error in the receive_bitmap() path,
if run-length encoded bitmap transfer is enabled.

If the bitmap is an exact multiple of PAGE_SIZE, which means the visible
capacity of the drbd device is an exact multiple of 128 MiB (for 4k page
size), and bitmap compression (use-rle) is enabled (which became default
with 8.4), and the very last bit is dirty and reported in an rle
comressed bitmap packet, we ended up trying to kmap_atomic a page pointer
that does not exist (bitmap->bm_pages[last index + 1]).

bug introduced by:
    Date:   Fri Jul 24 15:33:24 2009 +0200
    set bits: optimize for complete last word, fix off-by-one-word corner case

made effective by:
    Date:   Thu Dec 16 00:32:38 2010 +0100
    drbd: get rid of unused debug code

    Long time ago, we had paranoia code in the bitmap that allocated one
    extra word, assigned a magic value, and checked on every occasion that
    the magic value was still unchanged.

    That debug code is unused, the extra long word complicates code a bit.
    Get rid of it.

No-one triggered this bug in the last few years, because a large subset
of our userbase is unaffected:
 * typically the last few blocks of a device are not modified
   frequently, and remain unset
 * use-rle was disabled by default in drbd < 8.4
 * those with slightly "odd" device sizes, or
 * drbd internal meta data (which will skew the device size slightly,
   thus makes it harder to have a bug relevant device size)

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
2012-11-08 16:58:32 +01:00
..
Kconfig drbd: Kconfig fix 2009-12-29 17:38:28 +01:00
Makefile drbd: Split off netlink mandatory attribute handling into separate file 2012-11-08 16:57:45 +01:00
drbd_actlog.c drbd: New disk option al-updates 2012-11-08 16:58:31 +01:00
drbd_bitmap.c drbd: fix access of unallocated pages and kernel panic 2012-11-08 16:58:32 +01:00
drbd_int.h drbd: allow bitmap to change during writeout from resync_finished 2012-11-08 16:58:28 +01:00
drbd_interval.c drbd: Iterate over all overlapping intervals in a tree 2011-10-14 16:47:37 +02:00
drbd_interval.h drbd: Iterate over all overlapping intervals in a tree 2011-10-14 16:47:37 +02:00
drbd_main.c drbd: use bitmap_parse instead of __bitmap_parse 2012-11-08 16:58:29 +01:00
drbd_nl.c drbd: New disk option al-updates 2012-11-08 16:58:31 +01:00
drbd_nla.c drbd: Split off netlink mandatory attribute handling into separate file 2012-11-08 16:57:45 +01:00
drbd_nla.h drbd: Split off netlink mandatory attribute handling into separate file 2012-11-08 16:57:45 +01:00
drbd_proc.c drbd: Move list of epochs from mdev to tconn 2012-11-08 16:58:08 +01:00
drbd_receiver.c drbd: Keep the listening socket open while trying to connect to the peer 2012-11-08 16:58:31 +01:00
drbd_req.c drbd: fix resend/resubmit of frozen IO 2012-11-08 16:58:27 +01:00
drbd_req.h drbd: fix potential deadlock during "restart" of conflicting writes 2012-11-08 16:58:21 +01:00
drbd_state.c drbd: allow bitmap to change during writeout from resync_finished 2012-11-08 16:58:28 +01:00
drbd_state.h drbd: Improved logging of state changes 2012-11-08 16:45:06 +01:00
drbd_strings.c drbd: Allow volumes to become primary only on one side 2012-11-04 00:16:31 +01:00
drbd_vli.h Fix common misspellings 2011-03-31 11:26:23 -03:00
drbd_worker.c drbd: simplify retry path of failed READ requests 2012-11-08 16:58:24 +01:00
drbd_wrappers.h drbd: Split off netlink mandatory attribute handling into separate file 2012-11-08 16:57:45 +01:00