Skip to content

Commit

Permalink
net: bridge: fix ioctl old_deviceless bridge argument
Browse files Browse the repository at this point in the history
Commit ad2f99a ("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: ad2f99a ("net: bridge: move bridge ioctls out of .ndo_do_ioctl")
Signed-off-by: Nikolay Aleksandrov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Nikolay Aleksandrov authored and davem330 committed Aug 5, 2021
1 parent 893b195 commit cbd7ad2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/bridge/br_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cbd7ad2

Please sign in to comment.