From: Greg Kroah-Hartman Date: Mon, 9 Apr 2007 15:52:31 +0000 (-0400) Subject: SCSI: use the proper semaphore to protect the class lists X-Git-Tag: v2.6.22-rc1~1119^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b7bb125dc3d0ca3f72c9116525ce0f018a9844e1;p=platform%2Fupstream%2Fkernel-adaptation-pc.git 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 --- diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 38c3a29..bd8e7f3 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -435,7 +435,7 @@ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) 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(unsigned short hostnum) break; } } - up_read(&class->subsys.rwsem); + up(&class->sem); return shost; }