Re: [PATCH for-next 2/3] IB/usnic: fix potential deadlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 11, 2018 at 02:15:42PM -0800, Parvi Kaustubhi wrote:
> Acquiring the rtnl lock while holding usdev_lock could result in a
> deadlock.
> 
> For example:
> 
> usnic_ib_query_port()
> | mutex_lock(&us_ibdev->usdev_lock)
>  | ib_get_eth_speed()
>   | rtnl_lock()
> 
> rtnl_lock()
> | usnic_ib_netdevice_event()
>  | mutex_lock(&us_ibdev->usdev_lock)
> 
> This commit moves the usdev_lock acquisition after the rtnl lock has
> been released.
> This is safe to do because usdev_lock is not protecting anything being
> accessed in ib_get_eth_speed(). Hence, the correct order of holding
> locks
> (rtnl -> usdev_lock) is not violated.
> 
> Signed-off-by: Parvi Kaustubhi <pkaustub@xxxxxxxxx>
> ---
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Applied to for-next, thanks

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux