linux/drivers/md
Milan Broz f4808ca99a dm table: reject devices without request fns
This patch adds a check that a block device has a request function
defined before it is used.  Otherwise, misconfiguration can cause an oops.

Because we are allowing devices with zero size e.g. an offline multipath
device as in commit 2cd54d9bed
("dm: allow offline devices") there needs to be an additional check
to ensure devices are initialised.  Some block devices, like a loop
device without a backing file, exist but have no request function.

Reproducer is trivial: dm-mirror on unbound loop device
(no backing file on loop devices)

dmsetup create x --table "0 8 mirror core 2 8 sync 2 /dev/loop0 0 /dev/loop1 0"

and mirror resync will immediatelly cause OOps.

BUG: unable to handle kernel NULL pointer dereference at   (null)
 ? generic_make_request+0x2bd/0x590
 ? kmem_cache_alloc+0xad/0x190
 submit_bio+0x53/0xe0
 ? bio_add_page+0x3b/0x50
 dispatch_io+0x1ca/0x210 [dm_mod]
 ? read_callback+0x0/0xd0 [dm_mirror]
 dm_io+0xbb/0x290 [dm_mod]
 do_mirror+0x1e0/0x748 [dm_mirror]

Signed-off-by: Milan Broz <mbroz@redhat.com>
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2011-05-29 13:02:52 +01:00
..
bitmap.c md/bitmap: fix saving of events_cleared and other state. 2011-05-11 14:26:30 +10:00
bitmap.h Fix common misspellings 2011-03-31 11:26:23 -03:00
dm-bio-record.h
dm-crypt.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm 2011-03-25 20:51:44 -07:00
dm-delay.c
dm-exception-store.c
dm-exception-store.h
dm-flakey.c dm: add flakey target 2011-03-24 13:54:24 +00:00
dm-io.c
dm-ioctl.c dm ioctl: add flag to wipe buffers for secure data 2011-03-24 13:54:30 +00:00
dm-kcopyd.c
dm-linear.c
dm-log-userspace-base.c
dm-log-userspace-transfer.c
dm-log-userspace-transfer.h
dm-log.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm 2011-03-25 20:51:44 -07:00
dm-mpath.c dm mpath: allow table load with no priority groups 2011-03-24 13:54:33 +00:00
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-queue-length.c
dm-raid1.c
dm-raid.c md/dm - remove remains of plug_fn callback. 2011-04-18 18:25:41 +10:00
dm-region-hash.c Fix common misspellings 2011-03-31 11:26:23 -03:00
dm-round-robin.c
dm-service-time.c
dm-snap-persistent.c
dm-snap-transient.c
dm-snap.c dm: fix opening log and cow devices for read only tables 2011-03-24 13:52:14 +00:00
dm-stripe.c dm stripe: implement merge method 2011-03-24 13:54:35 +00:00
dm-sysfs.c
dm-table.c dm table: reject devices without request fns 2011-05-29 13:02:52 +01:00
dm-target.c
dm-uevent.c
dm-uevent.h
dm-zero.c
dm.c block: fix non-atomic access to genhd inflight structures 2011-03-22 08:35:35 +01:00
dm.h block: Require subsystems to explicitly allocate bio_set integrity mempool 2011-03-17 11:11:05 +01:00
faulty.c Fix common misspellings 2011-03-31 11:26:23 -03:00
Kconfig dm: add flakey target 2011-03-24 13:54:24 +00:00
linear.c block: Require subsystems to explicitly allocate bio_set integrity mempool 2011-03-17 11:11:05 +01:00
linear.h
Makefile dm: add flakey target 2011-03-24 13:54:24 +00:00
md.c md: allow resync_start to be set while an array is active. 2011-05-11 15:52:21 +10:00
md.h md: provide generic support for handling unplug callbacks. 2011-04-18 18:25:42 +10:00
multipath.c md: make error_handler functions more uniform and correct. 2011-05-11 14:38:44 +10:00
multipath.h md/multipath: discard ->working_disks in favour of ->degraded 2011-05-11 14:38:02 +10:00
raid0.c block: Require subsystems to explicitly allocate bio_set integrity mempool 2011-03-17 11:11:05 +01:00
raid0.h
raid1.c md: allow resync_start to be set while an array is active. 2011-05-11 15:52:21 +10:00
raid1.h md/raid1: improve handling of pages allocated for write-behind. 2011-05-11 14:51:19 +10:00
raid5.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-05-23 09:12:26 -07:00
raid5.h md - remove old plugging code. 2011-04-18 18:25:42 +10:00
raid10.c md/raid10: reformat some loops with less indenting. 2011-05-11 14:54:41 +10:00
raid10.h Fix common misspellings 2011-03-31 11:26:23 -03:00