Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/ib_srp: Fix a deadlock

Remove the flush_workqueue(system_long_wq) call since flushing
system_long_wq is deadlock-prone and since that call is redundant with a
preceding cancel_work_sync()

Link: https://lore.kernel.org/r/20220215210511.28303-3-bvanassche@acm.org
Fixes: ef6c49d87c34 ("IB/srp: Eliminate state SRP_TARGET_DEAD")
Reported-by: syzbot+831661966588c802aae9@syzkaller.appspotmail.com
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Bart Van Assche and committed by
Jason Gunthorpe
081bdc9f c46fa891

+4 -2
+4 -2
drivers/infiniband/ulp/srp/ib_srp.c
··· 4047 4047 spin_unlock(&host->target_lock); 4048 4048 4049 4049 /* 4050 - * Wait for tl_err and target port removal tasks. 4050 + * srp_queue_remove_work() queues a call to 4051 + * srp_remove_target(). The latter function cancels 4052 + * target->tl_err_work so waiting for the remove works to 4053 + * finish is sufficient. 4051 4054 */ 4052 - flush_workqueue(system_long_wq); 4053 4055 flush_workqueue(srp_remove_wq); 4054 4056 4055 4057 kfree(host);