Star64_linux/drivers/infiniband/core
Jason Gunthorpe 2ee9bf346f RDMA/addr: Fix race with netevent_callback()/rdma_addr_cancel()
This three thread race can result in the work being run once the callback
becomes NULL:

       CPU1                 CPU2                   CPU3
 netevent_callback()
                     process_one_req()       rdma_addr_cancel()
                      [..]
     spin_lock_bh()
  	set_timeout()
     spin_unlock_bh()

						spin_lock_bh()
						list_del_init(&req->list);
						spin_unlock_bh()

		     req->callback = NULL
		     spin_lock_bh()
		       if (!list_empty(&req->list))
                         // Skipped!
		         // cancel_delayed_work(&req->work);
		     spin_unlock_bh()

		    process_one_req() // again
		     req->callback() // BOOM
						cancel_delayed_work_sync()

The solution is to always cancel the work once it is completed so any
in between set_timeout() does not result in it running again.

Cc: stable@vger.kernel.org
Fixes: 44e75052bc ("RDMA/rdma_cm: Make rdma_addr_cancel into a fence")
Link: https://lore.kernel.org/r/20200930072007.1009692-1-leon@kernel.org
Reported-by: Dan Aloni <dan@kernelim.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2020-09-30 15:29:05 -03:00
..
addr.c RDMA/addr: Fix race with netevent_callback()/rdma_addr_cancel() 2020-09-30 15:29:05 -03:00
agent.c
agent.h
cache.c
cgroup.c
cm.c Linux 5.9-rc3 2020-08-31 12:28:12 -03:00
cm_msgs.h
cm_trace.c RDMA/cm: Replace pr_debug() call sites with tracepoints 2020-08-24 19:41:41 -03:00
cm_trace.h RDMA/cm: Add tracepoints to track MAD send operations 2020-08-24 19:41:41 -03:00
cma.c RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
cma_configfs.c
cma_priv.h
cma_trace.c
cma_trace.h RDMA/core: Move the rdma_show_ib_cm_event() macro 2020-08-24 16:01:47 -03:00
core_priv.h RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
counters.c RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
cq.c RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
device.c RDMA: Convert RWQ table logic to ib_core allocation scheme 2020-09-17 14:04:33 -03:00
ib_core_uverbs.c
iwcm.c
iwcm.h
iwpm_msg.c
iwpm_util.c
iwpm_util.h
lag.c
mad.c
mad_priv.h
mad_rmpp.c
mad_rmpp.h
Makefile RDMA/cm: Replace pr_debug() call sites with tracepoints 2020-08-24 19:41:41 -03:00
mr_pool.c
multicast.c
netlink.c
nldev.c
opa_smi.h
packer.c
rdma_core.c RDMA/core: Remove ucontext->closing 2020-09-30 15:27:19 -03:00
rdma_core.h
restrack.c RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
restrack.h RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
roce_gid_mgmt.c
rw.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sa.h
sa_query.c
security.c
smi.c
smi.h
sysfs.c
trace.c
ucma.c RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
ud_header.c
umem.c RDMA/mlx4: Use ib_umem_num_dma_blocks() 2020-09-11 10:24:54 -03:00
umem_odp.c
user_mad.c
uverbs.h
uverbs_cmd.c RDMA/core: Align write and ioctl checks of QP types 2020-09-29 13:11:06 -03:00
uverbs_ioctl.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
uverbs_main.c RDMA: Clean MW allocation and free flows 2020-09-17 14:04:32 -03:00
uverbs_marshall.c
uverbs_std_types.c RDMA: Convert RWQ table logic to ib_core allocation scheme 2020-09-17 14:04:33 -03:00
uverbs_std_types_async_fd.c
uverbs_std_types_counters.c RDMA: Make counters destroy symmetrical 2020-09-09 14:14:29 -03:00
uverbs_std_types_cq.c RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00
uverbs_std_types_device.c RDMA: Fix link active_speed size 2020-09-18 10:31:24 -03:00
uverbs_std_types_dm.c
uverbs_std_types_flow_action.c
uverbs_std_types_mr.c
uverbs_std_types_qp.c
uverbs_std_types_srq.c
uverbs_std_types_wq.c RDMA: Restore ability to return error for destroy WQ 2020-09-09 14:14:29 -03:00
uverbs_uapi.c
verbs.c RDMA/restrack: Improve readability in task name management 2020-09-22 19:47:35 -03:00