scsi: core: Fix incorrect usage of shost_for_each_device
shost_for_each_device(sdev, shost) \ for ((sdev) = __scsi_iterate_devices((shost), NULL); \ (sdev); \ (sdev) = __scsi_iterate_devices((shost), (sdev))) When terminating shost_for_each_device() iteration with break or return, scsi_device_put() should be used to prevent stale scsi device references from being left behind. Link: https://lore.kernel.org/r/20200518074420.39275-1-yebin10@huawei.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Ye Bin <yebin10@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Esse commit está contido em:
@@ -1412,6 +1412,7 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: skip START_UNIT, past eh deadline\n",
|
||||
current->comm));
|
||||
scsi_device_put(sdev);
|
||||
break;
|
||||
}
|
||||
stu_scmd = NULL;
|
||||
@@ -1478,6 +1479,7 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: skip BDR, past eh deadline\n",
|
||||
current->comm));
|
||||
scsi_device_put(sdev);
|
||||
break;
|
||||
}
|
||||
bdr_scmd = NULL;
|
||||
|
Referência em uma nova issue
Block a user