linux/drivers/scsi
Gustavo A. R. Silva 9ed143cf73 scsi: hisi_sas: Fix NULL pointer dereference
[ Upstream commit f4445bb93d ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-01 09:16:44 +01:00
..
aacraid
aic7xxx
aic94xx
arcmsr scsi: arcmsr: clean up clang warning on extraneous parentheses 2019-11-24 08:20:59 +01:00
arm
be2iscsi
bfa scsi: bfa: Avoid implicit enum conversion in bfad_im_post_vendor_event 2019-12-01 09:16:28 +01:00
bnx2fc
bnx2i
csiostor
cxgbi
cxlflash
device_handler scsi: scsi_dh_alua: handle RTPG sense code correctly during state transitions 2019-11-10 11:27:20 +01:00
dpt
esas2r
fcoe
fnic
hisi_sas scsi: hisi_sas: Fix NULL pointer dereference 2019-12-01 09:16:44 +01:00
ibmvscsi
ibmvscsi_tgt
isci scsi: isci: Change sci_controller_start_task's return type to sci_status 2019-12-01 09:16:28 +01:00
libfc
libsas scsi: libsas: always unregister the old device if going to discover new 2019-11-20 18:47:34 +01:00
lpfc scsi: lpfc: Fix errors in log messages. 2019-11-20 18:46:29 +01:00
megaraid scsi: megaraid_sas: Use 63-bit DMA addressing 2019-09-16 08:22:00 +02:00
mpt3sas
mvsas
osd
pcmcia
pm8001 scsi: pm80xx: Fixed system hang issue during kexec boot 2019-11-20 18:46:30 +01:00
qedf
qedi
qla2xxx scsi: qla2xxx: Fix duplicate switch's Nport ID entries 2019-11-20 18:46:27 +01:00
qla4xxx
smartpqi
snic
sym53c8xx_2 scsi: sym53c8xx: fix NULL pointer dereference panic in sym_int_sir() 2019-11-20 18:46:29 +01:00
ufs scsi: ufshcd: Fix NULL pointer dereference for in ufshcd_init 2019-11-20 18:46:48 +01:00
.gitignore
3w-9xxx.c
3w-9xxx.h
3w-sas.c
3w-sas.h
3w-xxxx.c
3w-xxxx.h
53c700_d.h_shipped
53c700.c
53c700.h
53c700.scr
a100u2w.c
a100u2w.h
a2091.c
a2091.h
a3000.c
a3000.h
a4000t.c
advansys.c
aha152x.c
aha152x.h
aha1542.c
aha1542.h
aha1740.c
aha1740.h
am53c974.c
atari_scsi.c
atp870u.c
atp870u.h
BusLogic.c
BusLogic.h
bvme6000_scsi.c
ch.c scsi: ch: Make it possible to open a ch device multiple times again 2019-10-29 09:19:50 +01:00
constants.c
dc395x.c scsi: dc395x: fix DMA API usage in sg_update_list 2019-12-01 09:16:32 +01:00
dc395x.h
dmx3191d.c
dpt_i2o.c
dpti.h
esp_scsi.c
esp_scsi.h
FlashPoint.c
g_NCR5380.c
gdth_ioctl.h
gdth_proc.c
gdth_proc.h
gdth.c
gdth.h
gvp11.c
gvp11.h
hosts.c
hpsa_cmd.h
hpsa.c scsi: hpsa: correct scsi command status issue after reset 2019-08-25 10:47:54 +02:00
hpsa.h
hptiop.c
hptiop.h
imm.c
imm.h
initio.c
initio.h
ipr.c
ipr.h
ips.c scsi: ips: fix missing break in switch 2019-12-01 09:16:26 +01:00
ips.h
iscsi_boot_sysfs.c
iscsi_tcp.c scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param 2019-12-01 09:16:28 +01:00
iscsi_tcp.h
jazz_esp.c
Kconfig scsi: fix kconfig dependency warning related to 53C700_LE_ON_BE 2019-11-10 11:27:22 +01:00
lasi700.c
libiscsi_tcp.c
libiscsi.c
mac_esp.c
mac_scsi.c
mac53c94.c
mac53c94.h
Makefile
megaraid.c scsi: megaraid: disable device when probe failed after enabled device 2019-10-29 09:19:29 +01:00
megaraid.h
mesh.c
mesh.h
mvme16x_scsi.c
mvme147.c
mvme147.h
mvumi.c
mvumi.h
ncr53c8xx.c
ncr53c8xx.h
NCR5380.c scsi: NCR5380: Check for bus reset 2019-11-20 18:47:52 +01:00
NCR5380.h scsi: NCR5380: Have NCR5380_select() return a bool 2019-11-20 18:47:49 +01:00
nsp32_debug.c
nsp32_io.h
nsp32.c
nsp32.h
osst_detect.h
osst_options.h
osst.c
osst.h
pmcraid.c
pmcraid.h
ppa.c
ppa.h
ps3rom.c
qla1280.c
qla1280.h
qlogicfas.c
qlogicfas408.c
qlogicfas408.h
qlogicpti.c
qlogicpti.h
raid_class.c
script_asm.pl
scsi_common.c
scsi_debug.c
scsi_debugfs.c
scsi_debugfs.h
scsi_devinfo.c
scsi_dh.c
scsi_error.c scsi: core: save/restore command resid for error handling 2019-10-29 09:19:49 +01:00
scsi_ioctl.c
scsi_lib_dma.c
scsi_lib.c scsi: core: Handle drivers which set sg_tablesize to zero 2019-11-20 18:45:10 +01:00
scsi_logging.c scsi: core: Reduce memory required for SCSI logging 2019-10-07 18:57:04 +02:00
scsi_logging.h
scsi_netlink.c
scsi_pm.c
scsi_priv.h
scsi_proc.c
scsi_sas_internal.h
scsi_scan.c
scsi_sysctl.c
scsi_sysfs.c scsi: core: try to get module before removing device 2019-10-29 09:19:50 +01:00
scsi_trace.c
scsi_transport_api.h
scsi_transport_fc.c
scsi_transport_iscsi.c
scsi_transport_sas.c
scsi_transport_spi.c
scsi_transport_srp.c
scsi.c
scsi.h
scsicam.c
sd_dif.c
sd_zbc.c
sd.c scsi: sd: Ignore a failure to sync cache due to lack of authorization 2019-10-29 09:19:49 +01:00
sd.h
sense_codes.h
ses.c
sg.c
sgiwd93.c
sim710.c
sni_53c710.c scsi: sni_53c710: fix compilation error 2019-11-10 11:27:21 +01:00
sr_ioctl.c
sr_vendor.c
sr.c
sr.h
st_options.h
st.c
st.h
stex.c
storvsc_drv.c
sun_esp.c
sun3_scsi_vme.c
sun3_scsi.c
sun3x_esp.c
virtio_scsi.c
vmw_pvscsi.c
vmw_pvscsi.h
wd33c93.c
wd33c93.h
wd719x.c
wd719x.h
xen-scsifront.c
zalon.c
zorro_esp.c scsi: zorro_esp: Limit DMA transfers to 65535 bytes 2019-12-01 09:16:33 +01:00
zorro7xx.c