Skip to content

Commit 04db158

Browse files
sherllyjgunthorpe
authored andcommitted
RDMA/i40iw: fix a potential NULL pointer dereference
A NULL pointer can be returned by in_dev_get(). Thus add a corresponding check so that a NULL pointer dereference will be avoided at this place. Fixes: 8e06af7 ("i40iw: add main, hdr, status") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Xiyu Yang <[email protected]> Signed-off-by: Xin Tan <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 6ca18d8 commit 04db158

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/infiniband/hw/i40iw/i40iw_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,8 @@ static void i40iw_add_ipv4_addr(struct i40iw_device *iwdev)
12251225
const struct in_ifaddr *ifa;
12261226

12271227
idev = in_dev_get(dev);
1228+
if (!idev)
1229+
continue;
12281230
in_dev_for_each_ifa_rtnl(ifa, idev) {
12291231
i40iw_debug(&iwdev->sc_dev, I40IW_DEBUG_CM,
12301232
"IP=%pI4, vlan_id=%d, MAC=%pM\n", &ifa->ifa_address,

0 commit comments

Comments
 (0)