Re: [PATCH] RDMA: Fix netdev tracker in ib_device_set_netdev

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

 



On Tue, Jul 09, 2024 at 03:44:55PM -0600, David Ahern wrote:
> If a netdev has already been assigned, ib_device_set_netdev needs to release
> the reference on the older but it is mistakenly being called for the new
> netdev. Fix it and in the process use netdev_put to be symmetrical with
> the netdev_hold.
> 
> Fixes: 09f530f0c6d6 ("RDMA: Add netdevice_tracker to ib_device_set_netdev()")
> Signed-off-by: David Ahern <dsahern@xxxxxxxxxx>
> ---
>  drivers/infiniband/core/device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index 55aa7aa32d4a..7ddaec923569 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -2167,7 +2167,7 @@ int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,
>  	}
>  
>  	if (old_ndev)
> -		netdev_tracker_free(ndev, &pdata->netdev_tracker);
> +		netdev_put(old_ndev, &pdata->netdev_tracker);

It should stay netdev_tracker_free() and not netdev_put(). We are
calling to __dev_put(old_ndev) later in the function.

Thanks

>  	if (ndev)
>  		netdev_hold(ndev, &pdata->netdev_tracker, GFP_ATOMIC);
>  	rcu_assign_pointer(pdata->netdev, ndev);
> -- 
> 2.30.2




[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