mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 09:34:12 +08:00
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: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
49f019d66d
commit
b7bb125dc3
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user