Skip to content

Commit

Permalink
mac802154: tx: don't allow if down while sync tx
Browse files Browse the repository at this point in the history
This patch holds rtnl lock while sync xmit inside of workqueue.
Otherwise we could down the interface while worker xmit handling.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed Oct 26, 2014
1 parent ed0a5dc commit 6001d52
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions net/mac802154/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/if_arp.h>
#include <linux/crc-ccitt.h>

#include <net/rtnetlink.h>
#include <net/ieee802154_netdev.h>
#include <net/mac802154.h>
#include <net/cfg802154.h>
Expand Down Expand Up @@ -50,16 +51,28 @@ static void mac802154_xmit_worker(struct work_struct *work)
struct sk_buff *skb = cb->skb;
int res;

rtnl_lock();

/* check if ifdown occurred while schedule */
if (!netif_running(skb->dev))
goto err_tx;

res = local->ops->xmit_sync(&local->hw, skb);
if (res) {
pr_debug("transmission failed\n");
/* Restart the netif queue on each sub_if_data object. */
ieee802154_wake_queue(&local->hw);
kfree_skb(skb);
} else {
/* Restart the netif queue on each sub_if_data object. */
ieee802154_xmit_complete(&local->hw, skb);
}
if (res)
goto err_tx;

ieee802154_xmit_complete(&local->hw, skb);

rtnl_unlock();

return;

err_tx:
/* Restart the netif queue on each sub_if_data object. */
ieee802154_wake_queue(&local->hw);
rtnl_unlock();
kfree_skb(skb);
pr_debug("transmission failed\n");
}

static netdev_tx_t
Expand Down

0 comments on commit 6001d52

Please sign in to comment.