Skip to content

Commit

Permalink
phonet: use siocdevprivate
Browse files Browse the repository at this point in the history
phonet has a single private ioctl that is broken in compat
mode on big-endian machines today because the data returned
from it is never copied back to user space.

Move it over to the ndo_siocdevprivate callback, which also
fixes the compat issue.

Cc: Remi Denis-Courmont <courmisch@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Rémi Denis-Courmont <courmisch@gmail.com>
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 561d835 commit 4747c1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions drivers/net/usb/cdc-phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ static int usbpn_close(struct net_device *dev)
return usb_set_interface(pnd->usb, num, !pnd->active_setting);
}

static int usbpn_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static int usbpn_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
void __user *data, int cmd)
{
struct if_phonet_req *req = (struct if_phonet_req *)ifr;

Expand All @@ -269,7 +270,7 @@ static const struct net_device_ops usbpn_ops = {
.ndo_open = usbpn_open,
.ndo_stop = usbpn_close,
.ndo_start_xmit = usbpn_xmit,
.ndo_do_ioctl = usbpn_ioctl,
.ndo_siocdevprivate = usbpn_siocdevprivate,
};

static void usbpn_setup(struct net_device *dev)
Expand Down
6 changes: 3 additions & 3 deletions net/phonet/pn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ static int phonet_device_autoconf(struct net_device *dev)
struct if_phonet_req req;
int ret;

if (!dev->netdev_ops->ndo_do_ioctl)
if (!dev->netdev_ops->ndo_siocdevprivate)
return -EOPNOTSUPP;

ret = dev->netdev_ops->ndo_do_ioctl(dev, (struct ifreq *)&req,
SIOCPNGAUTOCONF);
ret = dev->netdev_ops->ndo_siocdevprivate(dev, (struct ifreq *)&req,
NULL, SIOCPNGAUTOCONF);
if (ret < 0)
return ret;

Expand Down

0 comments on commit 4747c1a

Please sign in to comment.