aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a89172c100f5..7bb6787de550 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2577,8 +2577,11 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
2577 * 2577 *
2578 * If door lock fails, always clear sdev->locked to 2578 * If door lock fails, always clear sdev->locked to
2579 * avoid this infinite loop. 2579 * avoid this infinite loop.
2580 *
2581 * This may happen before SCSI scan is complete. Make
2582 * sure qc->dev->sdev isn't NULL before dereferencing.
2580 */ 2583 */
2581 if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL) 2584 if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev)
2582 qc->dev->sdev->locked = 0; 2585 qc->dev->sdev->locked = 0;
2583 2586
2584 qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; 2587 qc->scsicmd->result = SAM_STAT_CHECK_CONDITION;