linux/drivers/scsi/hisi_sas
Gustavo A. R. Silva f4445bb93d scsi: hisi_sas: Fix NULL pointer dereference
There is a NULL pointer dereference in case *slot* happens to be NULL at
lines 1053 and 1878:

struct hisi_sas_cq *cq =
	&hisi_hba->cq[slot->dlvry_queue];

Notice that *slot* is being NULL checked at lines 1057 and 1881:
if (slot), which implies it may be NULL.

Fix this by placing the declaration and definition of variable cq, which
contains the pointer dereference slot->dlvry_queue, after slot has been
properly NULL checked.

Addresses-Coverity-ID: 1474515 ("Dereference before null check")
Addresses-Coverity-ID: 1474520 ("Dereference before null check")
Fixes: 584f53fe5f ("scsi: hisi_sas: Fix the race between IO completion and timeout for SMP/internal IO")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-10-19 18:27:49 -04:00
..
Kconfig scsi: hisi_sas: Remove depends on HAS_DMA in case of platform dependency 2018-03-21 18:34:21 -04:00
Makefile scsi: hisi_sas: add skeleton v3 hw driver 2017-06-19 21:31:25 -04:00
hisi_sas.h scsi: hisi_sas: Use block layer tag instead for IPTT 2018-10-16 00:27:04 -04:00
hisi_sas_main.c scsi: hisi_sas: Fix NULL pointer dereference 2018-10-19 18:27:49 -04:00
hisi_sas_v1_hw.c scsi: hisi_sas: Use block layer tag instead for IPTT 2018-10-16 00:27:04 -04:00
hisi_sas_v2_hw.c scsi: hisi_sas: Fix spin lock management in slot_index_alloc_quirk_v2_hw() 2018-10-16 17:50:49 -04:00
hisi_sas_v3_hw.c scsi: hisi_sas: Update v3 hw AIP_LIMIT and CFG_AGING_TIME register values 2018-10-16 00:27:04 -04:00