Skip to content

Commit

Permalink
mac802154: fix hold rtnl while ioctl
Browse files Browse the repository at this point in the history
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: Alexander Aring <alex.aring@gmail.com>
Reported-by: Matteo Petracca <matteo.petracca@sssup.it>
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed May 23, 2015
1 parent 2d8cbd3 commit 4a669f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/mac802154/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
(struct sockaddr_ieee802154 *)&ifr->ifr_addr;
int err = -ENOIOCTLCMD;

ASSERT_RTNL();

rtnl_lock();
spin_lock_bh(&sdata->mib_lock);

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

Expand All @@ -112,6 +112,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}

spin_unlock_bh(&sdata->mib_lock);
rtnl_unlock();
return err;
}

Expand Down

0 comments on commit 4a669f7

Please sign in to comment.