From: Yajun Deng <yajun.deng@linux.dev>
To: davem@davemloft.net, kuba@kernel.org
Cc: nikolay@nvidia.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Yajun Deng <yajun.deng@linux.dev>
Subject: [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock()
Date: Tue, 14 Sep 2021 11:01:50 +0800 [thread overview]
Message-ID: <20210914030150.5838-1-yajun.deng@linux.dev> (raw)
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
next reply other threads:[~2021-09-14 3:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-14 3:01 Yajun Deng [this message]
2021-09-14 5:18 ` [PATCH net-next] net: core: fix the order in dev_put() and rtnl_lock() Eric Dumazet
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=20210914030150.5838-1-yajun.deng@linux.dev \
--to=yajun.deng@linux.dev \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
/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