Like sd_pr_command, before use sshdr, we need to check the result of scsi_execute. Signed-off-by: zhengbin <zhengbin13@xxxxxxxxxx> --- drivers/scsi/scsi_scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 058079f..781f82a 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1385,7 +1385,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag retries, result)); if (result == 0) break; - else if (scsi_sense_valid(&sshdr)) { + else if (driver_byte(result) == DRIVER_SENSE && + scsi_sense_valid(&sshdr)) { if (sshdr.sense_key != UNIT_ATTENTION) break; } -- 2.7.4