Skip to content

Commit 6001d52

Browse files
alexaringholtmann
authored andcommitted
mac802154: tx: don't allow if down while sync tx
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 <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent ed0a5dc commit 6001d52

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

net/mac802154/tx.c

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/if_arp.h>
2222
#include <linux/crc-ccitt.h>
2323

24+
#include <net/rtnetlink.h>
2425
#include <net/ieee802154_netdev.h>
2526
#include <net/mac802154.h>
2627
#include <net/cfg802154.h>
@@ -50,16 +51,28 @@ static void mac802154_xmit_worker(struct work_struct *work)
5051
struct sk_buff *skb = cb->skb;
5152
int res;
5253

54+
rtnl_lock();
55+
56+
/* check if ifdown occurred while schedule */
57+
if (!netif_running(skb->dev))
58+
goto err_tx;
59+
5360
res = local->ops->xmit_sync(&local->hw, skb);
54-
if (res) {
55-
pr_debug("transmission failed\n");
56-
/* Restart the netif queue on each sub_if_data object. */
57-
ieee802154_wake_queue(&local->hw);
58-
kfree_skb(skb);
59-
} else {
60-
/* Restart the netif queue on each sub_if_data object. */
61-
ieee802154_xmit_complete(&local->hw, skb);
62-
}
61+
if (res)
62+
goto err_tx;
63+
64+
ieee802154_xmit_complete(&local->hw, skb);
65+
66+
rtnl_unlock();
67+
68+
return;
69+
70+
err_tx:
71+
/* Restart the netif queue on each sub_if_data object. */
72+
ieee802154_wake_queue(&local->hw);
73+
rtnl_unlock();
74+
kfree_skb(skb);
75+
pr_debug("transmission failed\n");
6376
}
6477

6578
static netdev_tx_t

0 commit comments

Comments
 (0)