Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nikolay Aleksandrov <razor@blackwall.org>
To: netdev@vger.kernel.org
Cc: roopa@nvidia.com, arnd@arndb.de,
	bridge@lists.linux-foundation.org,
	Nikolay Aleksandrov <nikolay@nvidia.com>
Subject: [PATCH net-next 2/3] net: bridge: fix ioctl old_deviceless bridge argument
Date: Thu,  5 Aug 2021 11:29:02 +0300	[thread overview]
Message-ID: <20210805082903.711396-3-razor@blackwall.org> (raw)
In-Reply-To: <20210805082903.711396-1-razor@blackwall.org>

From: Nikolay Aleksandrov <nikolay@nvidia.com>

Commit ad2f99aedf8f ("net: bridge: move bridge ioctls out of .ndo_do_ioctl")
changed the source of the argument copy in bridge's old_deviceless() from
args[1] (user ptr to device name) to uarg (ptr to ioctl arguments) causing
wrong device name to be used.

Example (broken, bridge exists but is up):
$ brctl delbr bridge
bridge bridge doesn't exist; can't delete it

Example (working):
$ brctl delbr bridge
bridge bridge is still up; can't delete it

Fixes: ad2f99aedf8f ("net: bridge: move bridge ioctls out of .ndo_do_ioctl")
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
---
 net/bridge/br_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index 2f848de3e755..793b0db9d9a3 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -351,7 +351,7 @@ static int old_deviceless(struct net *net, void __user *uarg)
 		if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
 			return -EPERM;
 
-		if (copy_from_user(buf, uarg, IFNAMSIZ))
+		if (copy_from_user(buf, (void __user *)args[1], IFNAMSIZ))
 			return -EFAULT;
 
 		buf[IFNAMSIZ-1] = 0;
-- 
2.31.1


  parent reply	other threads:[~2021-08-05  8:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  8:29 [PATCH net-next 0/3] net: bridge: fix recent ioctl changes Nikolay Aleksandrov
2021-08-05  8:29 ` [PATCH net-next 1/3] net: bridge: fix ioctl locking Nikolay Aleksandrov
2021-08-05  9:29   ` Nikolay Aleksandrov
2021-08-05  8:29 ` Nikolay Aleksandrov [this message]
2021-08-05  8:29 ` [PATCH net-next 3/3] net: core: don't call SIOCBRADD/DELIF for non-bridge devices Nikolay Aleksandrov
2021-08-05 10:40 ` [PATCH net-next 0/3] net: bridge: fix recent ioctl changes patchwork-bot+netdevbpf

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=20210805082903.711396-3-razor@blackwall.org \
    --to=razor@blackwall.org \
    --cc=arnd@arndb.de \
    --cc=bridge@lists.linux-foundation.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@nvidia.com \
    --cc=roopa@nvidia.com \
    --subject='Re: [PATCH net-next 2/3] net: bridge: fix ioctl old_deviceless bridge argument' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).