SCSI: fix race in device_create
authorGreg Kroah-Hartman <gregkh@suse.de>
Sat, 17 May 2008 00:55:12 +0000 (17:55 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 20 May 2008 20:31:56 +0000 (13:31 -0700)
commit24b42566c3fcbb5a9011d1446783d0f5844ccd45
tree0e1de28631d02446580adf5fbb98feb981b20b5a
parentc013d040b70bc2bff5465917ebb255a70b650396
SCSI: fix race in device_create

There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.

This patch fixes the problem by using the new function,
device_create_drvdata().  It fixes the problem in all of the scsi
drivers that need it.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/ch.c
drivers/scsi/osst.c
drivers/scsi/sg.c
drivers/scsi/st.c