]> git.hungrycats.org Git - linux/commit
RDMA/hns: Fix UAF for cq async event
authorChengchang Tang <tangchengchang@huawei.com>
Fri, 12 Apr 2024 09:16:11 +0000 (17:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2024 07:49:43 +0000 (09:49 +0200)
commit39d26cf46306bdc7ae809ecfdbfeff5aa1098911
tree7db64dba73269507c69fbbd7997dea23b19c1b5e
parent72dc542f0d8977e7d41d610db6bb65c47cad43e9
RDMA/hns: Fix UAF for cq async event

[ Upstream commit a942ec2745ca864cd8512142100e4027dc306a42 ]

The refcount of CQ is not protected by locks. When CQ asynchronous
events and CQ destruction are concurrent, CQ may have been released,
which will cause UAF.

Use the xa_lock() to protect the CQ refcount.

Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240412091616.370789-6-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_cq.c