mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-13 07:31:07 +00:00
RDMA/netlink: Fix locking around __ib_get_device_by_index
[ Upstream commitf8978bd95c] Holding locks is mandatory when calling __ib_device_get_by_index, otherwise there are races during the list iteration with device removal. Since the locks are static to device.c, __ib_device_get_by_index can never be called correctly by any user out side the file. Make the function static and provide a safe function that gets the correct locks and returns a kref'd pointer. Fix all callers. Fixes:e5c9469efc("RDMA/netlink: Add nldev device doit implementation") Fixes:c3f66f7b00("RDMA/netlink: Implement nldev port doit callback") Fixes:7d02f605f0("RDMA/netlink: Add nldev port dumpit implementation") Reviewed-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7cbd67344e
commit
935454915c
3 changed files with 54 additions and 20 deletions
Loading…
Add table
Add a link
Reference in a new issue