Close race in md_probe
commita23a984f8413296fc7656c0593717d9618e6548e
authorNeil Brown <neilb@suse.de>
Thu, 31 Jul 2008 18:46:13 +0000 (31 20:46 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Aug 2008 16:03:13 +0000 (6 09:03 -0700)
tree71b48c85e5df654736dad9831032d0f73e432fd2
parent97a9945a6459ff63dc904d412e6c137b68d0d7d0
Close race in md_probe

[ Upstream commit f48ed538386cb41559282d989354e8f5d442d71c ]

There is a possible race in md_probe.  If two threads call md_probe
for the same device, then one could exit (having checked that
->gendisk exists) before the other has called kobject_init_and_add,
thus returning an incomplete kobj which will cause problems when
we try to add children to it.

So extend the range of protection of disks_mutex slightly to
avoid this possibility.

Signed-off-by: Neil Brown <neilb@suse.de>
CC: Oliver Pinter <oliver.pntr@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/md.c