提交 b7bb125d 编写于 作者: G Greg Kroah-Hartman

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 <James.Bottomley@SteelEye.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 49f019d6
...@@ -435,7 +435,7 @@ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) ...@@ -435,7 +435,7 @@ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
struct class_device *cdev; struct class_device *cdev;
struct Scsi_Host *shost = ERR_PTR(-ENXIO), *p; struct Scsi_Host *shost = ERR_PTR(-ENXIO), *p;
down_read(&class->subsys.rwsem); down(&class->sem);
list_for_each_entry(cdev, &class->children, node) { list_for_each_entry(cdev, &class->children, node) {
p = class_to_shost(cdev); p = class_to_shost(cdev);
if (p->host_no == hostnum) { if (p->host_no == hostnum) {
...@@ -443,7 +443,7 @@ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) ...@@ -443,7 +443,7 @@ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
break; break;
} }
} }
up_read(&class->subsys.rwsem); up(&class->sem);
return shost; return shost;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册