From: Hannes Reinecke <hare@suse.de>
Date: Tue, 14 May 2019 12:36:46 +0200
Subject: [PATCH] lpfc: validate command in lpfc_sli4_scmd_to_wqidx_distr()
References: bsc#1129138
Patch-Mainline: never, SLE15 specific
According to Broadcom we need to validate the command to avoid
crashes with blk-mq.
Suggested-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/lpfc/lpfc_scsi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 100a4a5a5b99..d1aab85f5102 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -3932,7 +3932,8 @@ int lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba,
uint32_t tag;
uint16_t hwq;
- if (cmnd && shost_use_blk_mq(cmnd->device->host)) {
+ if (cmnd && shost_use_blk_mq(cmnd->device->host) &&
+ cmnd->request && cmnd->request->q) {
tag = blk_mq_unique_tag(cmnd->request);
hwq = blk_mq_unique_tag_to_hwq(tag);
--
2.16.4