aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-09 02:36:59 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-09 13:50:29 -0500
commitf7cb96f105fb406e8db5e68e0cdd5067e2556d34 (patch)
treee17cee80d85dc1aefdc7d8710a1210e3cb6a66f7 /net/mac802154
parent87023e1058c9ead2314c27761991816b48f949ef (diff)
mac802154: protect address changes via ioctl
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 <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/iface.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index d635f367b03f..83715b5ffe43 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -63,6 +63,8 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
63 (struct sockaddr_ieee802154 *)&ifr->ifr_addr; 63 (struct sockaddr_ieee802154 *)&ifr->ifr_addr;
64 int err = -ENOIOCTLCMD; 64 int err = -ENOIOCTLCMD;
65 65
66 ASSERT_RTNL();
67
66 spin_lock_bh(&sdata->mib_lock); 68 spin_lock_bh(&sdata->mib_lock);
67 69
68 switch (cmd) { 70 switch (cmd) {
@@ -87,6 +89,11 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
87 break; 89 break;
88 } 90 }
89 case SIOCSIFADDR: 91 case SIOCSIFADDR:
92 if (netif_running(dev)) {
93 spin_unlock_bh(&sdata->mib_lock);
94 return -EBUSY;
95 }
96
90 dev_warn(&dev->dev, 97 dev_warn(&dev->dev,
91 "Using DEBUGing ioctl SIOCSIFADDR isn't recommended!\n"); 98 "Using DEBUGing ioctl SIOCSIFADDR isn't recommended!\n");
92 if (sa->family != AF_IEEE802154 || 99 if (sa->family != AF_IEEE802154 ||