RDMA/irdma: Fix potential NULL-ptr-dereference
authorNikita Zhandarovich <n.zhandarovich@fintech.ru>
Thu, 26 Jan 2023 18:52:30 +0000 (10:52 -0800)
committerLeon Romanovsky <leon@kernel.org>
Sun, 29 Jan 2023 12:55:54 +0000 (14:55 +0200)
commit5d9745cead1f121974322b94ceadfb4d1e67960e
treec0a8998301ecb495a3b8d8c1e77859fa8ff83960
parente632291a2dbce45a24cddeb5fe28fe71d724ba43
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: 146b9756f14c ("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>
drivers/infiniband/hw/irdma/cm.c