* [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock()
@ 2021-09-14 3:01 Yajun Deng
2021-09-14 5:18 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Yajun Deng @ 2021-09-14 3:01 UTC (permalink / raw)
To: davem, kuba; +Cc: nikolay, netdev, linux-kernel, Yajun Deng
The dev_put() should be after rtnl_lock() in case for race.
Fixes: 893b19587534 ("net: bridge: fix ioctl locking")
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
net/core/dev_ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 0e87237fd871..9796fa35fe88 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -384,8 +384,8 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data,
dev_hold(dev);
rtnl_unlock();
err = br_ioctl_call(net, netdev_priv(dev), cmd, ifr, NULL);
- dev_put(dev);
rtnl_lock();
+ dev_put(dev);
return err;
case SIOCSHWTSTAMP:
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock()
2021-09-14 3:01 [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock() Yajun Deng
@ 2021-09-14 5:18 ` Eric Dumazet
2021-09-14 7:52 ` Nikolay Aleksandrov
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2021-09-14 5:18 UTC (permalink / raw)
To: Yajun Deng, davem, kuba; +Cc: nikolay, netdev, linux-kernel
On 9/13/21 8:01 PM, Yajun Deng wrote:
> The dev_put() should be after rtnl_lock() in case for race.
>
> Fixes: 893b19587534 ("net: bridge: fix ioctl locking")
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
> net/core/dev_ioctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
> index 0e87237fd871..9796fa35fe88 100644
> --- a/net/core/dev_ioctl.c
> +++ b/net/core/dev_ioctl.c
> @@ -384,8 +384,8 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data,
> dev_hold(dev);
> rtnl_unlock();
> err = br_ioctl_call(net, netdev_priv(dev), cmd, ifr, NULL);
> - dev_put(dev);
> rtnl_lock();
> + dev_put(dev);
> return err;
>
> case SIOCSHWTSTAMP:
>
What race exactly are you trying to avoid ?
This patch does not look needed to me.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock()
2021-09-14 5:18 ` Eric Dumazet
@ 2021-09-14 7:52 ` Nikolay Aleksandrov
0 siblings, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2021-09-14 7:52 UTC (permalink / raw)
To: Eric Dumazet, Yajun Deng, davem, kuba; +Cc: netdev, linux-kernel
On 14/09/2021 08:18, Eric Dumazet wrote:
>
>
> On 9/13/21 8:01 PM, Yajun Deng wrote:
>> The dev_put() should be after rtnl_lock() in case for race.
>>
>> Fixes: 893b19587534 ("net: bridge: fix ioctl locking")
>> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
>> ---
>> net/core/dev_ioctl.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
>> index 0e87237fd871..9796fa35fe88 100644
>> --- a/net/core/dev_ioctl.c
>> +++ b/net/core/dev_ioctl.c
>> @@ -384,8 +384,8 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data,
>> dev_hold(dev);
>> rtnl_unlock();
>> err = br_ioctl_call(net, netdev_priv(dev), cmd, ifr, NULL);
>> - dev_put(dev);
>> rtnl_lock();
>> + dev_put(dev);
>> return err;
>>
>> case SIOCSHWTSTAMP:
>>
>
> What race exactly are you trying to avoid ?
>
> This patch does not look needed to me.
>
+1
There isn't a race there
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-14 7:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 3:01 [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock() Yajun Deng
2021-09-14 5:18 ` Eric Dumazet
2021-09-14 7:52 ` Nikolay Aleksandrov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.