RDMA/irdma: Fix a window for use-after-free
authorMustafa Ismail <mustafa.ismail@intel.com>
Tue, 5 Jul 2022 23:08:13 +0000 (18:08 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:53 +0000 (14:23 +0200)
commit92520864ef9f912f38b403d172a0ded020683d55
treeeeb3728a2ca8c7c15cb5fa13ebd0b08aa8e8b18f
parent62d610cfc16fc8bf263566af1295c65e28773625
RDMA/irdma: Fix a window for use-after-free

[ Upstream commit 8ecef7890b3aea78c8bbb501a4b5b8134367b821 ]

During a destroy CQ an interrupt may cause processing of a CQE after CQ
resources are freed by irdma_cq_free_rsrc(). Fix this by moving the call
to irdma_cq_free_rsrc() after the irdma_sc_cleanup_ceqes(), which is
called under the cq_lock.

Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
Link: https://lore.kernel.org/r/20220705230815.265-6-shiraz.saleem@intel.com
Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/irdma/verbs.c