linux/drivers/infiniband/hw
Shifeng Li 2b78832f50 RDMA/irdma: Fix UAF in irdma_sc_ccq_get_cqe_info()
When removing the irdma driver or unplugging its aux device, the ccq
queue is released before destorying the cqp_cmpl_wq queue.
But in the window, there may still be completion events for wqes. That
will cause a UAF in irdma_sc_ccq_get_cqe_info().

[34693.333191] BUG: KASAN: use-after-free in irdma_sc_ccq_get_cqe_info+0x82f/0x8c0 [irdma]
[34693.333194] Read of size 8 at addr ffff889097f80818 by task kworker/u67:1/26327
[34693.333194]
[34693.333199] CPU: 9 PID: 26327 Comm: kworker/u67:1 Kdump: loaded Tainted: G           O     --------- -t - 4.18.0 #1
[34693.333200] Hardware name: SANGFOR Inspur/NULL, BIOS 4.1.13 08/01/2016
[34693.333211] Workqueue: cqp_cmpl_wq cqp_compl_worker [irdma]
[34693.333213] Call Trace:
[34693.333220]  dump_stack+0x71/0xab
[34693.333226]  print_address_description+0x6b/0x290
[34693.333238]  ? irdma_sc_ccq_get_cqe_info+0x82f/0x8c0 [irdma]
[34693.333240]  kasan_report+0x14a/0x2b0
[34693.333251]  irdma_sc_ccq_get_cqe_info+0x82f/0x8c0 [irdma]
[34693.333264]  ? irdma_free_cqp_request+0x151/0x1e0 [irdma]
[34693.333274]  irdma_cqp_ce_handler+0x1fb/0x3b0 [irdma]
[34693.333285]  ? irdma_ctrl_init_hw+0x2c20/0x2c20 [irdma]
[34693.333290]  ? __schedule+0x836/0x1570
[34693.333293]  ? strscpy+0x83/0x180
[34693.333296]  process_one_work+0x56a/0x11f0
[34693.333298]  worker_thread+0x8f/0xf40
[34693.333301]  ? __kthread_parkme+0x78/0xf0
[34693.333303]  ? rescuer_thread+0xc50/0xc50
[34693.333305]  kthread+0x2a0/0x390
[34693.333308]  ? kthread_destroy_worker+0x90/0x90
[34693.333310]  ret_from_fork+0x1f/0x40

Fixes: 44d9e52977 ("RDMA/irdma: Implement device initialization definitions")
Signed-off-by: Shifeng Li <lishifeng1992@126.com>
Link: https://lore.kernel.org/r/20231121101236.581694-1-lishifeng1992@126.com
Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2023-11-22 13:52:52 +02:00
..
bnxt_re RDMA/bnxt_re: Correct module description string 2023-11-22 13:51:48 +02:00
cxgb4 RDMA/cxgb4: Check skb value for failure to allocate 2023-09-11 14:55:53 +03:00
efa RDMA/efa: Fix wrong resources deallocation order 2023-08-22 17:21:53 +03:00
erdma RDMA/erdma: Fix NULL pointer access in regmr_cmd 2023-09-18 10:42:19 +03:00
hfi1 RDMA for v6.7 2023-11-02 15:20:30 -10:00
hns RDMA/hns: Fix unnecessary err return when using invalid congest control algorithm 2023-11-13 10:25:29 +02:00
irdma RDMA/irdma: Fix UAF in irdma_sc_ccq_get_cqe_info() 2023-11-22 13:52:52 +02:00
mana RDMA/mana_ib: Use v2 version of cfg_rx_steer_req to enable RX coalescing 2023-06-01 12:52:01 -03:00
mlx4 IB/mlx4: Fix the size of a buffer in add_port_entries() 2023-09-23 21:53:24 +03:00
mlx5 IB/mlx5: Fix init stage error handling to avoid double free of same QP and UAF 2023-10-31 11:16:05 -03:00
mthca IB/mthca: Annotate struct mthca_icm_table with __counted_by 2023-10-02 14:44:54 +03:00
ocrdma RDMA: Remove unnecessary ternary operators 2023-07-31 15:16:12 +03:00
qedr RDMA: Remove unnecessary ternary operators 2023-07-31 15:16:12 +03:00
qib RDMA for v6.7 2023-11-02 15:20:30 -10:00
usnic RDMA/usnic: Annotate struct usnic_uiom_chunk with __counted_by 2023-10-02 14:44:54 +03:00
vmw_pvrdma RDMA/core: Remove NULL check before dev_{put, hold} 2023-10-24 18:16:04 +03:00
Makefile RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter 2022-11-11 11:40:09 +02:00