1
0
Fork 0
alistair23-linux/drivers/scsi
Bo Wu d45a917138 scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func
[ Upstream commit bba340c79b ]

In iscsi_if_rx func, after receiving one request through
iscsi_if_recv_msg func, iscsi_if_send_reply will be called to try to
reply to the request in a do-while loop.  If the iscsi_if_send_reply
function keeps returning -EAGAIN, a deadlock will occur.

For example, a client only send msg without calling recvmsg func, then
it will result in the watchdog soft lockup.  The details are given as
follows:

	sock_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ISCSI);
	retval = bind(sock_fd, (struct sock addr*) & src_addr, sizeof(src_addr);
	while (1) {
		state_msg = sendmsg(sock_fd, &msg, 0);
		//Note: recvmsg(sock_fd, &msg, 0) is not processed here.
	}
	close(sock_fd);

watchdog: BUG: soft lockup - CPU#7 stuck for 22s! [netlink_test:253305] Sample time: 4000897528 ns(HZ: 250) Sample stat:
curr: user: 675503481560, nice: 321724050, sys: 448689506750, idle: 4654054240530, iowait: 40885550700, irq: 14161174020, softirq: 8104324140, st: 0
deta: user: 0, nice: 0, sys: 3998210100, idle: 0, iowait: 0, irq: 1547170, softirq: 242870, st: 0 Sample softirq:
         TIMER:        992
         SCHED:          8
Sample irqstat:
         irq    2: delta       1003, curr:    3103802, arch_timer
CPU: 7 PID: 253305 Comm: netlink_test Kdump: loaded Tainted: G           OE
Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
pstate: 40400005 (nZcv daif +PAN -UAO)
pc : __alloc_skb+0x104/0x1b0
lr : __alloc_skb+0x9c/0x1b0
sp : ffff000033603a30
x29: ffff000033603a30 x28: 00000000000002dd
x27: ffff800b34ced810 x26: ffff800ba7569f00
x25: 00000000ffffffff x24: 0000000000000000
x23: ffff800f7c43f600 x22: 0000000000480020
x21: ffff0000091d9000 x20: ffff800b34eff200
x19: ffff800ba7569f00 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0001000101000100
x13: 0000000101010000 x12: 0101000001010100
x11: 0001010101010001 x10: 00000000000002dd
x9 : ffff000033603d58 x8 : ffff800b34eff400
x7 : ffff800ba7569200 x6 : ffff800b34eff400
x5 : 0000000000000000 x4 : 00000000ffffffff
x3 : 0000000000000000 x2 : 0000000000000001
x1 : ffff800b34eff2c0 x0 : 0000000000000300 Call trace:
__alloc_skb+0x104/0x1b0
iscsi_if_rx+0x144/0x12bc [scsi_transport_iscsi]
netlink_unicast+0x1e0/0x258
netlink_sendmsg+0x310/0x378
sock_sendmsg+0x4c/0x70
sock_write_iter+0x90/0xf0
__vfs_write+0x11c/0x190
vfs_write+0xac/0x1c0
ksys_write+0x6c/0xd8
__arm64_sys_write+0x24/0x30
el0_svc_common+0x78/0x130
el0_svc_handler+0x38/0x78
el0_svc+0x8/0xc

Link: https://lore.kernel.org/r/EDBAAA0BBBA2AC4E9C8B6B81DEEE1D6915E3D4D2@dggeml505-mbx.china.huawei.com
Signed-off-by: Bo Wu <wubo40@huawei.com>
Reviewed-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-09 10:19:46 +01:00
..
aacraid PCI: Move ASPM declarations to linux/pci.h 2019-08-28 08:28:39 -05:00
aic7xxx
aic94xx scsi: aic94xx: Remove unnecessary null check 2019-07-30 12:12:59 -04:00
arcmsr
arm scsi: fas216: Mark expected switch fall-throughs 2019-08-12 21:54:03 -04:00
be2iscsi
bfa scsi: bfa: remove redundant assignment to variable error 2019-08-29 17:41:24 -04:00
bnx2fc SCSI fixes on 20191004 2019-10-05 12:53:27 -07:00
bnx2i
csiostor scsi: csiostor: Don't enable IRQs too early 2020-01-04 19:16:47 +01:00
cxgbi
cxlflash scsi: cxlflash: Mark expected switch fall-throughs 2019-07-30 15:58:28 -04:00
device_handler SCSI fixes on 20191025 2019-10-25 20:11:33 -04:00
dpt
esas2r scsi: esas2r: Prefer pcie_capability_read_word() 2019-08-12 22:04:06 -04:00
fcoe SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
fnic scsi: fnic: fix msix interrupt allocation 2019-09-07 15:29:12 -04:00
hisi_sas scsi: hisi_sas: Delete the debugfs folder of hisi_sas when the probe fails 2020-01-04 19:16:49 +01:00
ibmvscsi SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
ibmvscsi_tgt scsi: ibmvscsi_tgt: Mark expected switch fall-throughs 2019-07-30 15:59:53 -04:00
isci
libfc scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure 2019-07-29 21:12:35 -04:00
libsas scsi: libsas: stop discovering if oob mode is disconnected 2020-01-09 10:19:46 +01:00
lpfc scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func 2020-01-09 10:19:44 +01:00
megaraid SCSI misc on 20190919 2019-09-21 10:50:15 -07:00
mpt3sas scsi: mpt3sas: Reject NVMe Encap cmnds to unsupported HBA 2020-01-04 19:16:26 +01:00
mvsas
pcmcia
pm8001 scsi: pm80xx: Fix for SATA device discovery 2020-01-04 19:18:14 +01:00
qedf SCSI fixes on 20191004 2019-10-05 12:53:27 -07:00
qedi
qla2xxx scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI 2020-01-09 10:19:46 +01:00
qla4xxx scsi: iscsi: qla4xxx: fix double free in probe 2020-01-09 10:19:46 +01:00
smartpqi scsi: smartpqi: bump version 2019-08-29 18:31:39 -04:00
snic
sym53c8xx_2 scsi: sym53c8xx_2: remove redundant assignment to retv 2019-08-12 21:58:07 -04:00
ufs scsi: ufs: Fix up auto hibern8 enablement 2020-01-04 19:18:17 +01:00
.gitignore
3w-9xxx.c
3w-9xxx.h
3w-sas.c
3w-sas.h
3w-xxxx.c
3w-xxxx.h
53c700.c
53c700.h
53c700.scr
53c700_d.h_shipped
BusLogic.c
BusLogic.h
FlashPoint.c
Kconfig SCSI fixes on 20191025 2019-10-25 20:11:33 -04:00
Makefile
NCR5380.c scsi: NCR5380: Add disconnect_mask module parameter 2020-01-04 19:18:16 +01:00
NCR5380.h
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 scsi: atari_scsi: sun3_scsi: Set sg_tablesize to 1 instead of SG_NONE 2020-01-04 19:18:10 +01:00
atp870u.c
atp870u.h
bvme6000_scsi.c
ch.c scsi: ch: Make it possible to open a ch device multiple times again 2019-10-09 23:39:35 -04:00
constants.c
dc395x.c
dc395x.h
dmx3191d.c
dpt_i2o.c
dpti.h
esp_scsi.c
esp_scsi.h
fdomain.c scsi: fdomain: use BSTAT_{MSG|CMD|IO} in fdomain_work() 2019-07-30 12:17:28 -04:00
fdomain.h
fdomain_isa.c scsi: fdomain_isa: use CFG1_IRQ_MASK 2019-07-30 12:18:24 -04:00
fdomain_pci.c
g_NCR5380.c
gdth.c
gdth.h
gdth_ioctl.h
gdth_proc.c
gdth_proc.h
gvp11.c
gvp11.h
hosts.c SCSI fixes on 20190720 2019-07-20 10:04:58 -07:00
hpsa.c SCSI fixes on 20191025 2019-10-25 20:11:33 -04:00
hpsa.h
hpsa_cmd.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 scsi: iscsi: Don't send data to unbound connection 2020-01-04 19:18:17 +01:00
iscsi_tcp.h
jazz_esp.c
lasi700.c
libiscsi.c scsi: iscsi: Fix a potential deadlock in the timeout handler 2019-12-21 11:05:04 +01:00
libiscsi_tcp.c
mac53c94.c
mac53c94.h
mac_esp.c
mac_scsi.c scsi: atari_scsi: sun3_scsi: Set sg_tablesize to 1 instead of SG_NONE 2020-01-04 19:18:10 +01:00
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 scsi: ncr53c8xx: Mark expected switch fall-through 2019-08-07 21:53:23 -04:00
ncr53c8xx.h
nsp32.c
nsp32.h
nsp32_debug.c
nsp32_io.h
pmcraid.c scsi: pmcraid: Fix a typo - pcmraid --> pmcraid 2019-08-12 21:57:13 -04:00
pmcraid.h
ppa.c
ppa.h
ps3rom.c
qla1280.c qla1280: remove SGI SN2 support 2019-08-16 11:33:56 -07:00
qla1280.h qla1280: remove SGI SN2 support 2019-08-16 11:33:56 -07:00
qlogicfas.c
qlogicfas408.c
qlogicfas408.h
qlogicpti.c scsi: qlogicpti: Mark expected switch fall-throughs 2019-08-07 21:32:53 -04:00
qlogicpti.h
raid_class.c
script_asm.pl
scsi.c
scsi.h
scsi_common.c
scsi_debug.c scsi: scsi_debug: num_tgts must be >= 0 2020-01-04 19:18:15 +01:00
scsi_debugfs.c scsi: scsi_debugfs: Use for_each_set_bit to simplify code 2019-07-30 12:42:55 -04:00
scsi_debugfs.h
scsi_devinfo.c
scsi_dh.c
scsi_error.c scsi: core: save/restore command resid for error handling 2019-10-03 21:43:04 -04:00
scsi_ioctl.c
scsi_lib.c SCSI fixes on 20191111 2019-11-11 09:14:36 -08:00
scsi_lib_dma.c
scsi_logging.c scsi: core: Reduce memory required for SCSI logging 2019-08-07 21:47:29 -04:00
scsi_logging.h
scsi_netlink.c
scsi_pm.c scsi: core: remove dummy q->dev check 2019-09-12 07:11:58 -06:00
scsi_priv.h
scsi_proc.c drivers: Add generic helper to match any device 2019-07-30 13:07:42 +02:00
scsi_sas_internal.h
scsi_scan.c
scsi_sysctl.c
scsi_sysfs.c scsi: core: try to get module before removing device 2019-10-17 21:57:09 -04:00
scsi_trace.c scsi: tracing: Fix handling of TRANSFER LENGTH == 0 for READ(6) and WRITE(6) 2020-01-04 19:17:15 +01:00
scsi_transport_api.h
scsi_transport_fc.c
scsi_transport_iscsi.c scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func 2020-01-09 10:19:46 +01:00
scsi_transport_sas.c
scsi_transport_spi.c
scsi_transport_srp.c
scsicam.c
sd.c SCSI fixes on 20191101 2019-11-02 11:15:52 -07:00
sd.h scsi: implement REQ_OP_ZONE_RESET_ALL 2019-08-04 21:41:29 -06:00
sd_dif.c
sd_zbc.c scsi: sd_zbc: Fix sd_zbc_complete() 2019-11-05 23:17:53 -05:00
sense_codes.h
ses.c
sg.c
sgiwd93.c
sim710.c
sni_53c710.c scsi: sni_53c710: fix compilation error 2019-10-09 23:35:42 -04:00
sr.c
sr.h
sr_ioctl.c
sr_vendor.c
st.c
st.h
st_options.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.c scsi: atari_scsi: sun3_scsi: Set sg_tablesize to 1 instead of SG_NONE 2020-01-04 19:18:10 +01:00
sun3_scsi_vme.c
sun3x_esp.c
sun_esp.c
virtio_scsi.c scsi: virtio_scsi: unplug LUNs when events missed 2019-09-10 22:10:17 -04:00
vmw_pvscsi.c
vmw_pvscsi.h
wd33c93.c scsi: wd33c93: Mark expected switch fall-through 2019-08-07 21:35:59 -04:00
wd33c93.h
wd719x.c
wd719x.h
xen-scsifront.c
zalon.c
zorro7xx.c
zorro_esp.c scsi: zorro_esp: Limit DMA transfers to 65536 bytes (except on Fastlane) 2020-01-04 19:17:37 +01:00