Skip to content

Commit

Permalink
net: socket: return changed ifreq from SIOCDEVPRIVATE
Browse files Browse the repository at this point in the history
Some drivers that use SIOCDEVPRIVATE ioctl commands modify
the ifreq structure and expect it to be passed back to user
space, which has never really happened for compat mode
because the calling these drivers through ndo_do_ioctl
requires overwriting the ifr_data pointer.

Now that all drivers are converted to ndo_siocdevprivate,
change it to handle this correctly in both compat and
native mode.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arnd Bergmann authored and David S. Miller committed Jul 27, 2021
1 parent ad7eab2 commit 88fc023
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions net/core/dev_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,7 @@ static int dev_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
return -ENODEV;
}

/* fall back to do_ioctl for drivers not yet converted */
ifr->ifr_data = data;
return dev_do_ioctl(dev, ifr, cmd);
return -EOPNOTSUPP;
}

static int dev_siocwandev(struct net_device *dev, struct if_settings *ifs)
Expand Down
2 changes: 1 addition & 1 deletion net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -3234,7 +3234,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
struct net *net = sock_net(sk);

if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15))
return compat_ifr_data_ioctl(net, cmd, argp);
return sock_ioctl(file, cmd, (unsigned long)argp);

switch (cmd) {
case SIOCSIFBR:
Expand Down

0 comments on commit 88fc023

Please sign in to comment.