Commit 4a669f7d authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

mac802154: fix hold rtnl while ioctl

This patch fixes an issue to set address configuration with ioctl.
Accessing the mib requires rtnl lock and the ndo_do_ioctl doesn't hold
the rtnl lock while this callback is called. This patch do that
manually.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Reported-by: default avatarMatteo Petracca <matteo.petracca@sssup.it>
Reviewed-by: default avatarStefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 2d8cbd31
...@@ -62,8 +62,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -62,8 +62,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
(struct sockaddr_ieee802154 *)&ifr->ifr_addr; (struct sockaddr_ieee802154 *)&ifr->ifr_addr;
int err = -ENOIOCTLCMD; int err = -ENOIOCTLCMD;
ASSERT_RTNL(); rtnl_lock();
spin_lock_bh(&sdata->mib_lock); spin_lock_bh(&sdata->mib_lock);
switch (cmd) { switch (cmd) {
...@@ -90,6 +89,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -90,6 +89,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
case SIOCSIFADDR: case SIOCSIFADDR:
if (netif_running(dev)) { if (netif_running(dev)) {
spin_unlock_bh(&sdata->mib_lock); spin_unlock_bh(&sdata->mib_lock);
rtnl_unlock();
return -EBUSY; return -EBUSY;
} }
...@@ -112,6 +112,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -112,6 +112,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
} }
spin_unlock_bh(&sdata->mib_lock); spin_unlock_bh(&sdata->mib_lock);
rtnl_unlock();
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment