Skip to content

Commit

Permalink
af_ieee802154: fix ioctl processing
Browse files Browse the repository at this point in the history
fix two errors in ioctl processing:
1) if the ioctl isn't supported one should return -ENOIOCTLCMD
2) don't call ndo_do_ioctl if the device doesn't provide it

Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
  • Loading branch information
lumag committed Aug 6, 2009
1 parent 0bf52b9 commit 45a41d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/ieee802154/af_ieee802154.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
unsigned int cmd)
{
struct ifreq ifr;
int ret = -EINVAL;
int ret = -ENOIOCTLCMD;
struct net_device *dev;

if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
Expand All @@ -146,8 +146,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,

dev_load(sock_net(sk), ifr.ifr_name);
dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
if (dev->type == ARPHRD_IEEE802154 ||
dev->type == ARPHRD_IEEE802154_PHY)

if ((dev->type == ARPHRD_IEEE802154 ||
dev->type == ARPHRD_IEEE802154_PHY) &&
dev->netdev_ops->ndo_do_ioctl)
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);

if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq)))
Expand Down

0 comments on commit 45a41d1

Please sign in to comment.