linux_dsm_epyc7002/drivers/scsi
Michael Schmitz 9393c8de62 scsi: core: Handle drivers which set sg_tablesize to zero
In scsi_mq_setup_tags(), cmd_size is calculated based on zero size for the
scatter-gather list in case the low level driver uses SG_NONE in its host
template.

cmd_size is passed on to the block layer for calculation of the request
size, and we've seen NULL pointer dereference errors from the block layer
in drivers where SG_NONE is used and a mq IO scheduler is active,
apparently as a consequence of this (see commit 68ab2d76e4 ("scsi:
cxlflash: Set sg_tablesize to 1 instead of SG_NONE"), and a recent patch by
Finn Thain converting the three m68k NFR5380 drivers to avoid setting
SG_NONE).

Try to avoid these errors by accounting for at least one sg list entry when
calculating cmd_size, regardless of whether the low level driver set a zero
sg_tablesize.

Tested on 030 m68k with the atari_scsi driver - setting sg_tablesize to
SG_NONE no longer results in a crash when loading this driver.

CC: Finn Thain <fthain@telegraphics.com.au>
Link: https://lore.kernel.org/r/1572922150-4358-1-git-send-email-schmitzmic@gmail.com
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-11-06 00:44:34 -05:00
..
aacraid
aic7xxx
aic94xx
arcmsr
arm
be2iscsi
bfa
bnx2fc SCSI fixes on 20191004 2019-10-05 12:53:27 -07:00
bnx2i
csiostor
cxgbi
cxlflash
device_handler SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
dpt
esas2r
fcoe SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
fnic
hisi_sas scsi: hisi_sas: Make three functions static 2019-09-23 23:09:42 -04:00
ibmvscsi SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
ibmvscsi_tgt
isci
libfc
libsas
lpfc SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
megaraid SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
mpt3sas pci-v5.4-changes 2019-09-23 19:16:01 -07:00
mvsas
pcmcia
pm8001
qedf SCSI fixes on 20191004 2019-10-05 12:53:27 -07:00
qedi
qla2xxx scsi: qla2xxx: fix NPIV tear down process 2019-11-05 23:55:31 -05:00
qla4xxx
smartpqi
snic
sym53c8xx_2
ufs SCSI fixes on 20191004 2019-10-05 12:53:27 -07: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
constants.c
dc395x.c
dc395x.h
dmx3191d.c
dpt_i2o.c
dpti.h
esp_scsi.c
esp_scsi.h
fdomain_isa.c
fdomain_pci.c
fdomain.c
fdomain.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 pci-v5.4-changes 2019-09-23 19:16:01 -07:00
hpsa.h
hptiop.c
hptiop.h
imm.c
imm.h
initio.c
initio.h
ipr.c
ipr.h
ips.c
ips.h
iscsi_boot_sysfs.c
iscsi_tcp.c
iscsi_tcp.h
jazz_esp.c
Kconfig
lasi700.c
libiscsi_tcp.c
libiscsi.c
mac53c94.c
mac53c94.h
mac_esp.c
mac_scsi.c
Makefile
megaraid.c scsi: megaraid: disable device when probe failed after enabled device 2019-09-23 23:09:42 -04:00
megaraid.h
mesh.c
mesh.h
mvme16x_scsi.c
mvme147.c
mvme147.h
mvumi.c
mvumi.h
myrb.c
myrb.h
myrs.c
myrs.h
ncr53c8xx.c
ncr53c8xx.h
NCR5380.c
NCR5380.h
nsp32_debug.c
nsp32_io.h
nsp32.c
nsp32.h
pmcraid.c
pmcraid.h
ppa.c
ppa.h
ps3rom.c
qla1280.c
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c
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_ioctl.c
scsi_lib_dma.c
scsi_lib.c scsi: core: Handle drivers which set sg_tablesize to zero 2019-11-06 00:44:34 -05:00
scsi_logging.c
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_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 scsi: sd_zbc: Fix sd_zbc_complete() 2019-11-05 23:17:53 -05:00
sd.c for-5.4/post-2019-09-24 2019-09-24 16:31:50 -07:00
sd.h
sense_codes.h
ses.c
sg.c
sgiwd93.c
sim710.c
sni_53c710.c
sr_ioctl.c
sr_vendor.c
sr.c
sr.h
st_options.h
st.c
st.h
stex.c
storvsc_drv.c scsi: storvsc: setup 1:1 mapping between hardware queue and CPU queue 2019-09-23 23:09:42 -04:00
sun3_scsi_vme.c
sun3_scsi.c
sun3x_esp.c
sun_esp.c
virtio_scsi.c
vmw_pvscsi.c
vmw_pvscsi.h
wd33c93.c
wd33c93.h
wd719x.c
wd719x.h
xen-scsifront.c
zalon.c
zorro7xx.c
zorro_esp.c