linux/drivers
Saravanan Vajravel 29ff057c0a IB/isert: Fix dead lock in ib_isert
[ Upstream commit 691b048093 ]

- When a iSER session is released, ib_isert module is taking a mutex
  lock and releasing all pending connections. As part of this, ib_isert
  is destroying rdma cm_id. To destroy cm_id, rdma_cm module is sending
  CM events to CMA handler of ib_isert. This handler is taking same
  mutex lock. Hence it leads to deadlock between ib_isert & rdma_cm
  modules.

- For fix, created local list of pending connections and release the
  connection outside of mutex lock.

Calltrace:
---------
[ 1229.791410] INFO: task kworker/10:1:642 blocked for more than 120 seconds.
[ 1229.791416]       Tainted: G           OE    --------- -  - 4.18.0-372.9.1.el8.x86_64 #1
[ 1229.791418] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1229.791419] task:kworker/10:1    state:D stack:    0 pid:  642 ppid:     2 flags:0x80004000
[ 1229.791424] Workqueue: ib_cm cm_work_handler [ib_cm]
[ 1229.791436] Call Trace:
[ 1229.791438]  __schedule+0x2d1/0x830
[ 1229.791445]  ? select_idle_sibling+0x23/0x6f0
[ 1229.791449]  schedule+0x35/0xa0
[ 1229.791451]  schedule_preempt_disabled+0xa/0x10
[ 1229.791453]  __mutex_lock.isra.7+0x310/0x420
[ 1229.791456]  ? select_task_rq_fair+0x351/0x990
[ 1229.791459]  isert_cma_handler+0x224/0x330 [ib_isert]
[ 1229.791463]  ? ttwu_queue_wakelist+0x159/0x170
[ 1229.791466]  cma_cm_event_handler+0x25/0xd0 [rdma_cm]
[ 1229.791474]  cma_ib_handler+0xa7/0x2e0 [rdma_cm]
[ 1229.791478]  cm_process_work+0x22/0xf0 [ib_cm]
[ 1229.791483]  cm_work_handler+0xf4/0xf30 [ib_cm]
[ 1229.791487]  ? move_linked_works+0x6e/0xa0
[ 1229.791490]  process_one_work+0x1a7/0x360
[ 1229.791491]  ? create_worker+0x1a0/0x1a0
[ 1229.791493]  worker_thread+0x30/0x390
[ 1229.791494]  ? create_worker+0x1a0/0x1a0
[ 1229.791495]  kthread+0x10a/0x120
[ 1229.791497]  ? set_kthread_struct+0x40/0x40
[ 1229.791499]  ret_from_fork+0x1f/0x40

[ 1229.791739] INFO: task targetcli:28666 blocked for more than 120 seconds.
[ 1229.791740]       Tainted: G           OE    --------- -  - 4.18.0-372.9.1.el8.x86_64 #1
[ 1229.791741] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1229.791742] task:targetcli       state:D stack:    0 pid:28666 ppid:  5510 flags:0x00004080
[ 1229.791743] Call Trace:
[ 1229.791744]  __schedule+0x2d1/0x830
[ 1229.791746]  schedule+0x35/0xa0
[ 1229.791748]  schedule_preempt_disabled+0xa/0x10
[ 1229.791749]  __mutex_lock.isra.7+0x310/0x420
[ 1229.791751]  rdma_destroy_id+0x15/0x20 [rdma_cm]
[ 1229.791755]  isert_connect_release+0x115/0x130 [ib_isert]
[ 1229.791757]  isert_free_np+0x87/0x140 [ib_isert]
[ 1229.791761]  iscsit_del_np+0x74/0x120 [iscsi_target_mod]
[ 1229.791776]  lio_target_np_driver_store+0xe9/0x140 [iscsi_target_mod]
[ 1229.791784]  configfs_write_file+0xb2/0x110
[ 1229.791788]  vfs_write+0xa5/0x1a0
[ 1229.791792]  ksys_write+0x4f/0xb0
[ 1229.791794]  do_syscall_64+0x5b/0x1a0
[ 1229.791798]  entry_SYSCALL_64_after_hwframe+0x65/0xca

Fixes: bd3792205a ("iser-target: Fix pending connections handling in target stack shutdown sequnce")
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
Link: https://lore.kernel.org/r/20230606102531.162967-2-saravanan.vajravel@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-21 15:59:17 +02:00
..
accessibility tty: fix possible null-ptr-defer in spk_ttyio_release 2023-01-24 07:22:46 +01:00
acpi ACPI: resource: Add IRQ override quirk for LG UltraPC 17U70P 2023-06-09 10:32:25 +02:00
amba
android binder: fix UAF of alloc->vma in race with munmap() 2023-06-05 09:21:25 +02:00
ata ata: ahci: fix enum constants for gcc-13 2023-06-14 11:12:59 +02:00
atm atm: idt77252: fix kmemleak when rmmod idt77252 2023-03-30 12:47:48 +02:00
auxdisplay auxdisplay: hd44780: Fix potential memory leak in hd44780_remove() 2023-03-11 13:57:22 +01:00
base regmap: Account for register length when chunking 2023-06-09 10:32:34 +02:00
bcma
block xen/blkfront: Only check REQ_FUA for writes 2023-06-21 15:59:13 +02:00
bluetooth Bluetooth: hci_qca: fix debugfs registration 2023-06-14 11:13:06 +02:00
bus bus: mhi: host: Range check CHDBOFF and ERDBOFF 2023-05-17 11:50:14 +02:00
cdrom
char parisc: Flush gatt writes and adjust gatt mask in parisc_agp_mask_memory() 2023-06-21 15:59:13 +02:00
clk clk: tegra20: fix gcc-7 constant overflow warning 2023-05-24 17:36:47 +01:00
clocksource clocksource/drivers/davinci: Fix memory leak in davinci_timer_register when init fails 2023-05-11 23:00:37 +09:00
comedi comedi: adv_pci1760: Fix PWM instruction handling 2023-01-24 07:22:45 +01:00
connector
counter counter: 104-quad-8: Fix race condition between FLAG and CNTR reads 2023-04-26 13:51:55 +02:00
cpufreq cpufreq: use correct unit when verify cur freq 2023-05-11 23:00:25 +09:00
cpuidle cpuidle: psci: Iterate backwards over list in psci_pd_remove() 2023-03-22 13:31:36 +01:00
crypto crypto: sun8i-ss - Fix a test in sun8i_ss_setup_ivs() 2023-05-17 11:50:20 +02:00
cxl
dax dax/kmem: Fix leak of memory-hotplug resources 2023-03-10 09:40:08 +01:00
dca
devfreq PM/devfreq: governor: Add a private governor_data for governor 2023-01-12 11:58:51 +01:00
dio drivers: dio: fix possible memory leak in dio_init() 2022-12-31 13:14:27 +01:00
dma dmaengine: pl330: rename _start to prevent build error 2023-06-09 10:32:15 +02:00
dma-buf
edac EDAC/skx: Fix overflows on the DRAM row address mapping arrays 2023-05-11 23:00:20 +09:00
eisa
extcon extcon: usbc-tusb320: fix kernel-doc warning 2023-02-06 07:59:01 +01:00
firewire firewire: fix memory leak for payload of request subaction to IEC 61883-1 FCP region 2023-02-09 11:26:32 +01:00
firmware firmware: arm_ffa: Set handle field to zero in memory descriptor 2023-06-14 11:13:08 +02:00
fpga fpga: bridge: fix kernel-doc parameter description 2023-05-11 23:00:31 +09:00
fsi WRITE is "data source", not destination... 2023-02-09 11:26:34 +01:00
gnss
gpio gpio: mockup: Fix mode of debugfs files 2023-05-30 13:55:30 +01:00
gpu drm/amdgpu: add missing radeon secondary PCI ID 2023-06-21 15:59:15 +02:00
greybus
hid HID: wacom: avoid integer overflow in wacom_intuos_inout() 2023-06-09 10:32:27 +02:00
hsi HSI: omap_ssi_core: Fix error handling in ssi_init() 2022-12-31 13:14:32 +01:00
hv Drivers: vmbus: Check for channel allocation before looking up relids 2023-04-13 16:48:17 +02:00
hwmon hwmon: (pmbus/fsp-3y) Fix functionality bitmask in FSP-3Y YM-2151E 2023-05-11 23:00:25 +09:00
hwspinlock
hwtracing coresight: Fix signedness bug in tmc_etr_buf_insert_barrier_packet() 2023-05-30 13:55:32 +01:00
i2c i2c: sprd: Delete i2c adapter in .remove's error path 2023-06-14 11:13:08 +02:00
i3c
idle
iio iio: dac: build ad5758 driver when AD5758 is selected 2023-06-09 10:32:28 +02:00
infiniband IB/isert: Fix dead lock in ib_isert 2023-06-21 15:59:17 +02:00
input Input: fix open count when closing inhibited device 2023-06-14 11:13:04 +02:00
interconnect interconnect: qcom: osm-l3: fix icc_onecell_data allocation 2023-03-30 12:47:41 +02:00
iommu iommu/amd: Fix domain flush size when syncing iotlb 2023-06-09 10:32:31 +02:00
ipack
irqchip irqchip/gic: Correctly validate OF quirk descriptors 2023-06-21 15:59:14 +02:00
isdn mISDN: hfcmulti: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave() 2022-12-31 13:14:37 +01:00
leds leds: tca6507: Fix error handling of using fwnode_property_read_string 2023-05-11 23:00:37 +09:00
macintosh macintosh: via-pmu-led: requires ATA to be set 2023-05-11 23:00:34 +09:00
mailbox mailbox: mailbox-test: fix a locking issue in mbox_test_message_write() 2023-06-09 10:32:27 +02:00
mcb mcb-pci: Reallocate memory region to avoid memory overlapping 2023-05-24 17:36:47 +01:00
md dm thin metadata: check fail_io before using data_sm 2023-06-21 15:59:14 +02:00
media media: uvcvideo: Don't expose unsupported formats to userspace 2023-06-09 10:32:27 +02:00
memory memory: mvebu-devbus: Fix missing clk_disable_unprepare in mvebu_devbus_probe() 2023-02-01 08:27:03 +01:00
memstick memstick: r592: Fix UAF bug in r592_remove due to race condition 2023-05-24 17:36:43 +01:00
message scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition 2023-05-24 17:36:45 +01:00
mfd mfd: dln2: Fix memory leak in dln2_probe() 2023-05-24 17:36:48 +01:00
misc eeprom: at24: also select REGMAP 2023-06-14 11:13:08 +02:00
mmc mmc: pwrseq: sd8787: Fix WILC CHIP_EN and RESETN toggling order 2023-06-09 10:32:31 +02:00
most
mtd mtd: rawnand: marvell: don't set the NAND frequency select 2023-06-09 10:32:19 +02:00
mux
net octeontx2-af: fix lbk link credits on cn10k 2023-06-21 15:59:17 +02:00
nfc nfc: st-nci: Fix use after free bug in ndlc_remove due to race condition 2023-03-22 13:31:26 +01:00
ntb
nubus
nvdimm
nvme NVMe: Add MAXIO 1602 to bogus nid list. 2023-06-21 15:59:13 +02:00
nvmem nvmem: core: fix return value 2023-02-22 12:57:03 +01:00
of of: overlay: Fix missing of_node_put() in error case of init_overlay_changeset() 2023-06-21 15:59:12 +02:00
opp OPP: fix error checking in opp_migrate_dentry() 2023-03-10 09:39:15 +01:00
parisc parisc: Replace regular spinlock with spin_trylock on panic path 2023-05-24 17:36:48 +01:00
parport
pci PCI/EDR: Clear Device Status after EDR error recovery 2023-05-11 23:00:32 +09:00
pcmcia
perf perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() 2022-12-31 13:13:58 +01:00
phy phy: st: miphy28lp: use _poll_timeout functions for waits 2023-05-24 17:36:48 +01:00
pinctrl pinctrl: meson-axg: add missing GPIOA_18 gpio group 2023-06-14 11:13:07 +02:00
platform platform/x86: asus-wmi: Ignore WMI events with codes 0x7B, 0xC0 2023-06-21 15:59:12 +02:00
pnp PNP: fix name memory leak in pnp_alloc_dev() 2022-12-31 13:14:02 +01:00
power power: supply: Fix logic checking if system is running from battery 2023-06-21 15:59:13 +02:00
powercap powercap: fix possible name leak in powercap_register_zone() 2023-03-10 09:39:12 +01:00
pps
ps3
ptp ptp_qoriq: fix memory leak in probe() 2023-04-05 11:24:55 +02:00
pwm pwm: mtk-disp: Configure double buffering before reading in .get_state() 2023-05-11 23:00:38 +09:00
rapidio rapidio: devices: fix missing put_device in mport_cdev_open 2022-12-31 13:14:05 +01:00
ras
regulator regulator: Fix error checking for debugfs_create_dir 2023-06-21 15:59:13 +02:00
remoteproc remoteproc: stm32_rproc: Add mutex protection for workqueue 2023-05-24 17:36:44 +01:00
reset reset: uniphier-glue: Fix possible null-ptr-deref 2023-02-01 08:27:04 +01:00
rpmsg rpmsg: glink: Avoid infinite loop on intent for missing channel 2023-03-10 09:39:46 +01:00
rtc rtc: meson-vrtc: Use ktime_get_real_ts64() to get the current time 2023-05-11 23:00:35 +09:00
s390 s390/dasd: Use correct lock while counting channel queue length 2023-06-14 11:13:06 +02:00
sbus
scsi scsi: dpt_i2o: Do not process completions with invalid addresses 2023-06-09 10:32:34 +02:00
sh genirq: Add and use an irq_data_update_affinity helper 2023-03-11 13:57:31 +01:00
siox
slimbus
soc soc: ti: pm33xx: Fix refcount leak in am33xx_pm_probe 2023-05-11 23:00:20 +09:00
soundwire soundwire: qcom: gracefully handle too many ports in DT 2023-05-24 17:36:48 +01:00
spi spi: fsl-dspi: avoid SCK glitches with continuous transfers 2023-06-21 15:59:16 +02:00
spmi spmi: Add a check for remove callback when removing a SPMI driver 2023-05-11 23:00:34 +09:00
ssb
staging Revert "staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE" 2023-06-14 11:13:10 +02:00
target scsi: target: iscsit: Free cmds before session free 2023-05-24 17:36:45 +01:00
tc
tee tee: amdtee: Add return_origin to 'struct tee_cmd_load_ta' 2023-06-14 11:13:06 +02:00
thermal thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe 2023-05-11 23:00:38 +09:00
thunderbolt thunderbolt: Mask ring interrupt on Intel hardware as well 2023-06-21 15:59:15 +02:00
tty serial: lantiq: add missing interrupt ack 2023-06-21 15:59:15 +02:00
uio uio: uio_dmem_genirq: Fix deadlock between irq config and handling 2022-12-31 13:14:27 +01:00
usb usb: dwc3: gadget: Reset num TRBs before giving back the request 2023-06-21 15:59:15 +02:00
vdpa vduse: avoid empty string for dev name 2023-06-14 11:13:09 +02:00
vfio vfio/type1: restore locked_vm 2023-03-10 09:40:13 +01:00
vhost vhost_vdpa: support PACKED when setting-getting vring_base 2023-06-14 11:13:09 +02:00
video fbcon: Fix null-ptr-deref in soft_cursor 2023-06-09 10:32:33 +02:00
virt
virtio virtio_ring: don't update event idx on get_buf 2023-05-11 23:00:34 +09:00
visorbus
vlynq
vme vme: Fix error not catched in fake_init() 2022-12-31 13:14:30 +01:00
w1 w1: fix WARNING after calling w1_process() 2023-02-01 08:27:14 +01:00
watchdog watchdog: menz069_wdt: fix watchdog initialisation 2023-06-09 10:32:19 +02:00
xen xen/pvcalls-back: fix double frees with pvcalls_new_active_socket() 2023-05-30 13:55:32 +01:00
zorro
Kconfig
Makefile