mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Yajun Deng <yajun.deng@linux.dev>, davem@davemloft.net, kuba@kernel.org
Cc: nikolay@nvidia.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock()
Date: Mon, 13 Sep 2021 22:18:13 -0700	[thread overview]
Message-ID: <903c5bed-5958-8888-b55d-9c175664b2a1@gmail.com> (raw)
In-Reply-To: <20210914030150.5838-1-yajun.deng@linux.dev>



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.

  reply	other threads:[~2021-09-14  5:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14  3:01 Yajun Deng
2021-09-14  5:18 ` Eric Dumazet [this message]
2021-09-14  7:52   ` Nikolay Aleksandrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=903c5bed-5958-8888-b55d-9c175664b2a1@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@nvidia.com \
    --cc=yajun.deng@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®