linux/drivers/infiniband/hw
Yonatan Nachum cf38960386 RDMA/efa: Fix wrong resources deallocation order
[ Upstream commit dc202c57e9 ]

When trying to destroy QP or CQ, we first decrease the refcount and
potentially free memory regions allocated for the object and then
request the device to destroy the object. If the device fails, the
object isn't fully destroyed so the user/IB core can try to destroy the
object again which will lead to underflow when trying to decrease an
already zeroed refcount.

Deallocate resources in reverse order of allocating them to safely free
them.

Fixes: ff6629f88c ("RDMA/efa: Do not delay freeing of DMA pages")
Reviewed-by: Michael Margolin <mrgolin@amazon.com>
Reviewed-by: Yossi Leybovich <sleybo@amazon.com>
Signed-off-by: Yonatan Nachum <ynachum@amazon.com>
Link: https://lore.kernel.org/r/20230822082725.31719-1-ynachum@amazon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2023-09-13 09:42:57 +02:00
..
bnxt_re RDMA/bnxt_re: Prevent handling any completions after qp destroy 2023-08-03 10:24:04 +02:00
cxgb4 iw_cxgb4: Fix potential NULL dereference in c4iw_fill_res_cm_id_entry() 2023-03-10 09:33:39 +01:00
efa RDMA/efa: Fix wrong resources deallocation order 2023-09-13 09:42:57 +02:00
erdma RDMA/erdma: Use fixed hardware page size 2023-05-11 23:03:33 +09:00
hfi1 IB/hfi1: Fix possible panic during hotplug remove 2023-08-16 18:27:27 +02:00
hns RDMA/hns: Fix CQ and QP cache affinity 2023-09-13 09:42:53 +02:00
irdma RDMA/irdma: Prevent zero-length STAG registration 2023-09-13 09:42:56 +02:00
mlx4 RDMA/mlx4: Make check for invalid flags stricter 2023-08-03 10:24:02 +02:00
mlx5 RDMA/mlx5: Return the firmware result upon destroying QP/RQ 2023-08-23 17:52:21 +02:00
mthca RDMA/mthca: Fix crash when polling CQ for shared QPs 2023-08-03 10:24:03 +02:00
ocrdma IB: move from strlcpy with unused retval to strscpy 2022-08-21 14:18:02 +03:00
qedr RDMA/qedr: clean up work queue on failure in qedr_alloc_resources() 2022-10-28 12:59:40 -03:00
qib RDMA/qib: fix repeated words in comments 2022-09-20 14:11:14 +03:00
usnic RDMA/usnic: use iommu_map_atomic() under spin_lock() 2023-02-14 19:11:43 +01:00
vmw_pvrdma RDMA/pvrdma: Remove useless DMA-32 fallback configuration 2022-01-28 10:49:04 -04:00
Makefile RDMA/erdma: Add driver to kernel build environment 2022-07-27 16:04:05 -03:00