Skip to content

Commit 5d9745c

Browse files
Nikita Zhandarovichrleon
authored andcommitted
RDMA/irdma: Fix potential NULL-ptr-dereference
in_dev_get() can return NULL which will cause a failure once idev is dereferenced in in_dev_for_each_ifa_rtnl(). This patch adds a check for NULL value in idev beforehand. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 146b975 ("RDMA/irdma: Add connection manager") Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru> Link: https://lore.kernel.org/r/20230126185230.62464-1-n.zhandarovich@fintech.ru Reviewed-by: Sindhu Devale <sindhu.devale@intel.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent e632291 commit 5d9745c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • drivers/infiniband/hw/irdma

drivers/infiniband/hw/irdma/cm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,9 @@ static int irdma_add_mqh_4(struct irdma_device *iwdev,
17221722
continue;
17231723

17241724
idev = in_dev_get(ip_dev);
1725+
if (!idev)
1726+
continue;
1727+
17251728
in_dev_for_each_ifa_rtnl(ifa, idev) {
17261729
ibdev_dbg(&iwdev->ibdev,
17271730
"CM: Allocating child CM Listener forIP=%pI4, vlan_id=%d, MAC=%pM\n",

0 commit comments

Comments
 (0)