]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/cxgb4: Fix potential null-ptr-deref in pass_establish()
authorNikita Zhandarovich <n.zhandarovich@fintech.ru>
Thu, 2 Feb 2023 18:48:50 +0000 (10:48 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:36 +0000 (09:33 +0100)
commit30cc7ce112d8a59e46d5c41bc9bd3397c869a90a
treecdcb78a6f6fea63a01b574aaba32b29bbb6d328e
parent95d0c7a8e02e3b272905251be19f628c81a1a1ee
RDMA/cxgb4: Fix potential null-ptr-deref in pass_establish()

[ Upstream commit 12e5fc388dafff629953486421a560f214eab668 ]

If get_ep_from_tid() fails to lookup non-NULL value for ep, ep is
dereferenced later regardless of whether it is empty.
This patch adds a simple sanity check to fix the issue.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 3de6fa6a58d8 ("RDMA/iw_cxgb4: atomically lookup ep and get a reference")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://lore.kernel.org/r/20230202184850.29882-1-n.zhandarovich@fintech.ru
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/cxgb4/cm.c