From foo@baz Tue Apr 9 12:12:43 2002 Date: Mon, 9 Apr 2007 11:52:31 -0400 (EDT) To: Greg KH From: Greg Kroah-Hartman Subject: SCSI: use the proper semaphore to protect the class lists SCSI was using the incorrect lock to protect walking the list of all devices in the class. This patch fixes this. Cc: James Bottomley Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/hosts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -435,7 +435,7 @@ struct Scsi_Host *scsi_host_lookup(unsig struct class_device *cdev; struct Scsi_Host *shost = ERR_PTR(-ENXIO), *p; - down_read(&class->subsys.rwsem); + down(&class->sem); list_for_each_entry(cdev, &class->children, node) { p = class_to_shost(cdev); if (p->host_no == hostnum) { @@ -443,7 +443,7 @@ struct Scsi_Host *scsi_host_lookup(unsig break; } } - up_read(&class->subsys.rwsem); + up(&class->sem); return shost; }