Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6001d522 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann
Browse files

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent ed0a5dce
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -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>
@@ -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");
	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);
	} else {
		/* Restart the netif queue on each sub_if_data object. */
		ieee802154_xmit_complete(&local->hw, skb);
	}
	pr_debug("transmission failed\n");
}

static netdev_tx_t