Skip to content

Commit 5f8ca04

Browse files
chiarameiohasrleon
authored andcommitted
RDMA/device: Remove optimization in ib_device_get_netdev()
The caller of ib_device_get_netdev() relies on its result to accurately match a given netdev with the ib device associated netdev. ib_device_get_netdev returns NULL when the IB device associated netdev is unregistering, preventing the caller of matching netdevs properly. Thus, remove this optimization and return the netdev even if it is undergoing unregistration, allowing matching by the caller. This change ensures proper netdev matching and reference count handling by the caller of ib_device_get_netdev/ib_device_set_netdev API. Signed-off-by: Maher Sanalla <[email protected]> Signed-off-by: Chiara Meiohas <[email protected]> Signed-off-by: Michael Guralnik <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Kalesh AP <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 91b4b2c commit 5f8ca04

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

drivers/infiniband/core/device.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,15 +2252,6 @@ struct net_device *ib_device_get_netdev(struct ib_device *ib_dev,
22522252
spin_unlock(&pdata->netdev_lock);
22532253
}
22542254

2255-
/*
2256-
* If we are starting to unregister expedite things by preventing
2257-
* propagation of an unregistering netdev.
2258-
*/
2259-
if (res && res->reg_state != NETREG_REGISTERED) {
2260-
dev_put(res);
2261-
return NULL;
2262-
}
2263-
22642255
return res;
22652256
}
22662257

0 commit comments

Comments
 (0)