Skip to content

Commit

Permalink
mac802154: protect address changes via ioctl
Browse files Browse the repository at this point in the history
This patch adds a netif_running check while trying to change the address
attributes via ioctl. While netif_running is true these attributes
should be only readable.

Signed-off-by: Alexander Aring <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
alexaring authored and holtmann committed Nov 9, 2014
1 parent 87023e1 commit f7cb96f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/mac802154/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
int err = -ENOIOCTLCMD;

ASSERT_RTNL();

spin_lock_bh(&sdata->mib_lock);

switch (cmd) {
Expand All @@ -87,6 +89,11 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
break;
}
case SIOCSIFADDR:
if (netif_running(dev)) {
spin_unlock_bh(&sdata->mib_lock);
return -EBUSY;
}

dev_warn(&dev->dev,
"Using DEBUGing ioctl SIOCSIFADDR isn't recommended!\n");
if (sa->family != AF_IEEE802154 ||
Expand Down

0 comments on commit f7cb96f

Please sign in to comment.