Skip to content
Commit 5bb3c1e9 authored by Parvi Kaustubhi's avatar Parvi Kaustubhi Committed by Jason Gunthorpe
Browse files

IB/usnic: Fix deadlock



There is a dead lock in usnic ib_register and netdev_notify path.

	usnic_ib_discover_pf()
	| mutex_lock(&usnic_ib_ibdev_list_lock);
	 | usnic_ib_device_add();
	  | ib_register_device()
	   | usnic_ib_query_port()
	    | mutex_lock(&us_ibdev->usdev_lock);
	     | ib_get_eth_speed()
	      | rtnl_lock()

order of lock: &usnic_ib_ibdev_list_lock -> usdev_lock -> rtnl_lock

	rtnl_lock()
	 | usnic_ib_netdevice_event()
	  | mutex_lock(&usnic_ib_ibdev_list_lock);

order of lock: rtnl_lock -> &usnic_ib_ibdev_list_lock

Solution is to use the core's lock-free ib_device_get_by_netdev() scheme
to lookup ib_dev while handling netdev & inet events.

Signed-off-by: default avatarParvi Kaustubhi <pkaustub@cisco.com>
Reviewed-by: default avatarGovindarajulu Varadarajan <gvaradar@cisco.com>
Reviewed-by: default avatarTanmay Inamdar <tinamdar@cisco.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent ca22354b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment