summaryrefslogtreecommitdiff
path: root/net/mac802154/iface.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2015-05-26 15:06:10 +0300
committerMarcel Holtmann <marcel@holtmann.org>2015-05-26 19:03:01 +0300
commite34fd879f5516496c7241c9c2caf3a108295a30c (patch)
tree2c543fe67e4d3ef3d8a93bf00df71035f959f7bc /net/mac802154/iface.c
parentf72186d22aad44100e2dd17ccdcf13c4418ec3cb (diff)
downloadlinux-e34fd879f5516496c7241c9c2caf3a108295a30c.tar.xz
mac802154: Avoid rtnl deadlock in mac802154_wpan_ioctl().
->ndo_do_ioctl() can be entered with the rtnl lock already held, for example when sending a wext ioctl to a device (in which case the rtnl lock is taken by wext_ioctl_dispatch()), but mac802154_wpan_ioctl() currently unconditionally takes the rtnl lock on entry, which can cause deadlocks. To fix this, bail out of mac802154_wpan_ioctl() before taking the rtnl lock if the ioctl cmd is not one of the cmds we implement. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Acked-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154/iface.c')
-rw-r--r--net/mac802154/iface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index f30788d2702f..b544b5dc4bfb 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -62,6 +62,9 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
int err = -ENOIOCTLCMD;
+ if (cmd != SIOCGIFADDR && cmd != SIOCSIFADDR)
+ return err;
+
rtnl_lock();
switch (cmd) {