linux/drivers
Hou Pu ed43ffea78 scsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem
The iSCSI target login thread might get stuck with the following stack:

cat /proc/`pidof iscsi_np`/stack
[<0>] down_interruptible+0x42/0x50
[<0>] iscsit_access_np+0xe3/0x167
[<0>] iscsi_target_locate_portal+0x695/0x8ac
[<0>] __iscsi_target_login_thread+0x855/0xb82
[<0>] iscsi_target_login_thread+0x2f/0x5a
[<0>] kthread+0xfa/0x130
[<0>] ret_from_fork+0x1f/0x30

This can be reproduced via the following steps:

1. Initiator A tries to log in to iqn1-tpg1 on port 3260. After finishing
   PDU exchange in the login thread and before the negotiation is finished
   the the network link goes down. At this point A has not finished login
   and tpg->np_login_sem is held.

2. Initiator B tries to log in to iqn2-tpg1 on port 3260. After finishing
   PDU exchange in the login thread the target expects to process remaining
   login PDUs in workqueue context.

3. Initiator A' tries to log in to iqn1-tpg1 on port 3260 from a new
   socket. A' will wait for tpg->np_login_sem with np->np_login_timer
   loaded to wait for at most 15 seconds. The lock is held by A so A'
   eventually times out.

4. Before A' got timeout initiator B gets negotiation failed and calls
   iscsi_target_login_drop()->iscsi_target_login_sess_out().  The
   np->np_login_timer is canceled and initiator A' will hang forever.
   Because A' is now in the login thread, no new login requests can be
   serviced.

Fix this by moving iscsi_stop_login_thread_timer() out of
iscsi_target_login_sess_out(). Also remove iscsi_np parameter from
iscsi_target_login_sess_out().

Link: https://lore.kernel.org/r/20200729130343.24976-1-houpu@bytedance.com
Cc: stable@vger.kernel.org
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Hou Pu <houpu@bytedance.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-09-02 21:08:22 -04:00
..
accessibility TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
acpi More ACPI updates for 5.9-rc1 2020-08-15 08:18:22 -07:00
amba
android
ata
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
auxdisplay Minor cleanup for auxdisplay: 2020-08-06 18:09:34 -07:00
base More power management updates for 5.9-rc1 2020-08-07 13:13:09 -07:00
bcma bcma: gpio: Use irqchip template 2020-08-02 18:26:51 +03:00
block block-5.9-2020-08-14 2020-08-15 20:36:42 -07:00
bluetooth Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2020-07-31 15:11:52 -07:00
bus MIPS upates for v5.9 2020-08-06 10:54:07 -07:00
cdrom
char Linux 5.8 2020-08-11 11:58:31 +10:00
clk More ACPI updates for 5.9-rc1 2020-08-15 08:18:22 -07:00
clocksource - Core Frameworks 2020-08-15 08:09:38 -07:00
connector
counter
cpufreq cpufreq: intel_pstate: Implement passive mode with HWP enabled 2020-08-11 17:29:45 +02:00
cpuidle powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
crypto virtio: fixes, features 2020-08-11 14:34:17 -07:00
dax libnvdimm for 5.9 2020-08-11 10:59:19 -07:00
dca
devfreq PM / devfreq: Fix the wrong end with semicolon 2020-07-30 17:22:58 +09:00
dio
dma Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
dma-buf A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
edac Fixes for ie31200 driver that missed the first pull 2020-08-15 08:25:41 -07:00
eisa
extcon
firewire
firmware uaccess: add force_uaccess_{begin,end} helpers 2020-08-12 10:57:59 -07:00
fpga
fsi
gnss
gpio This is the bulk of GPIO changes for the v5.9 kernel cycle: 2020-08-05 12:56:27 -07:00
gpu pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
greybus
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2020-08-10 16:33:54 -07:00
hsi
hv hyperv-fixes for 5.9-rc 2020-08-14 13:31:25 -07:00
hwmon pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
hwspinlock
hwtracing
i2c More ACPI updates for 5.9-rc1 2020-08-15 08:18:22 -07:00
i3c
ide
idle Remove uninitialized_var() macro for v5.9-rc1 2020-08-04 13:49:43 -07:00
iio
infiniband mm/gup: remove task_struct pointer for all gup code 2020-08-12 10:58:04 -07:00
input Cleanup, SECCOMP_FILTER support, message printing fixes, and other 2020-08-15 18:50:32 -07:00
interconnect Char/Misc driver patches for 5.9-rc1 2020-08-05 11:43:47 -07:00
iommu Merge branch 'akpm' (patches from Andrew) 2020-08-12 11:24:12 -07:00
ipack
irqchip The usual boring updates from the interrupt subsystem: 2020-08-04 18:11:58 -07:00
isdn
leds LEDs changes for 5.9-rc1. 2020-08-05 19:24:27 -07:00
lightnvm
macintosh powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
mailbox iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
mcb
md block-5.9-2020-08-14 2020-08-15 20:36:42 -07:00
media IOMMU Updates for Linux v5.9 2020-08-11 14:13:24 -07:00
memory IOMMU Updates for Linux v5.9 2020-08-11 14:13:24 -07:00
memstick MMC core: 2020-08-05 13:23:24 -07:00
message
mfd - Core Frameworks 2020-08-15 08:09:38 -07:00
misc Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
mmc This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
most drivers: most: add USB adapter driver 2020-07-31 14:38:12 +02:00
mtd This pull request contains changes for JFFS2, UBI and UBIFS 2020-08-10 18:20:04 -07:00
mux
net scsi: fcoe: Fix I/O path allocation 2020-08-17 21:52:39 -04:00
nfc
ntb ntb: intel: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
nubus
nvdimm mm: add thp_size 2020-08-14 19:56:56 -07:00
nvme for-5.9/block-merge-20200804 2020-08-05 11:12:34 -07:00
nvmem
of MIPS upates for v5.9 2020-08-06 10:54:07 -07:00
opp Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-08-04 12:44:53 +02:00
oprofile
parisc Merge branch 'parisc-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2020-08-12 12:41:15 -07:00
parport
pci pci-v5.9-changes 2020-08-07 18:48:15 -07:00
pcmcia
perf It looks like a smaller batch of clk updates this time around. In the core 2020-08-07 13:35:51 -07:00
phy
pinctrl This is the bulk of the pin control changes for the v5.9 2020-08-09 12:52:28 -07:00
platform linux-watchdog 5.9-rc1 tag 2020-08-12 12:13:44 -07:00
pnp
power power supply and reset changes for the v5.9 series 2020-08-07 21:27:37 -07:00
powercap This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
pps
ps3
ptp ptp: only allow phase values lower than 1 period 2020-08-05 12:06:44 -07:00
pwm pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
rapidio rapidio/rio_mport_cdev: use array_size() helper in copy_{from,to}_user() 2020-08-12 10:58:01 -07:00
ras
regulator Merge remote-tracking branch 'regulator/for-5.9' into regulator-next 2020-07-30 23:27:08 +01:00
remoteproc remoteproc updates for v5.9 2020-08-11 11:17:45 -07:00
reset
rpmsg
rtc RTC for 5.9 2020-08-12 17:17:00 -07:00
s390 scsi: zfcp: Fix use-after-free in request timeout handlers 2020-08-17 22:12:09 -04:00
sbus
scsi scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA 2020-09-01 21:45:23 -04:00
sfi
sh iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
siox
slimbus
soc Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
soundwire
spi sound updates for 5.9 2020-08-06 14:27:31 -07:00
spmi
ssb Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
staging pci-v5.9-changes 2020-08-07 18:48:15 -07:00
target scsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem 2020-09-02 21:08:22 -04:00
tc
tee
thermal - Core Frameworks 2020-08-15 08:09:38 -07:00
thunderbolt thunderbolt: merge fix for kunix_resource changes 2020-08-09 11:06:10 -07:00
tty TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
uio
usb media updates for v5.9-rc1 2020-08-07 13:00:53 -07:00
vdpa virtio: fixes, features 2020-08-11 14:34:17 -07:00
vfio VFIO updates for v5.9-rc1 2020-08-12 12:09:36 -07:00
vhost virtio: fixes, features 2020-08-11 14:34:17 -07:00
video pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
virt
virtio virtio: pci: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
visorbus
vlynq
vme
w1
watchdog linux-watchdog 5.9-rc1 tag 2020-08-12 12:13:44 -07:00
xen xen: branch for v5.9-rc1b 2020-08-14 13:34:37 -07:00
zorro
Kconfig
Makefile