linux/drivers/infiniband
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
..
core IB/uverbs: Fix an potential error pointer dereference 2023-09-13 09:42:53 +02:00
hw RDMA/efa: Fix wrong resources deallocation order 2023-09-13 09:42:57 +02:00
sw RDMA/siw: Correct wrong debug message 2023-09-13 09:42:57 +02:00
ulp Revert "IB/isert: Fix incorrect release of isert connection" 2023-09-13 09:42:57 +02:00
Kconfig RDMA: Disable IB HW for UML 2022-12-31 13:32:36 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00