提交 6001d522 编写于 作者: A Alexander Aring 提交者: Marcel Holtmann

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: NAlexander Aring <alex.aring@gmail.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 ed0a5dce
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/crc-ccitt.h> #include <linux/crc-ccitt.h>
#include <net/rtnetlink.h>
#include <net/ieee802154_netdev.h> #include <net/ieee802154_netdev.h>
#include <net/mac802154.h> #include <net/mac802154.h>
#include <net/cfg802154.h> #include <net/cfg802154.h>
...@@ -50,16 +51,28 @@ static void mac802154_xmit_worker(struct work_struct *work) ...@@ -50,16 +51,28 @@ static void mac802154_xmit_worker(struct work_struct *work)
struct sk_buff *skb = cb->skb; struct sk_buff *skb = cb->skb;
int res; 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); res = local->ops->xmit_sync(&local->hw, skb);
if (res) { if (res)
pr_debug("transmission failed\n"); goto err_tx;
ieee802154_xmit_complete(&local->hw, skb);
rtnl_unlock();
return;
err_tx:
/* Restart the netif queue on each sub_if_data object. */ /* Restart the netif queue on each sub_if_data object. */
ieee802154_wake_queue(&local->hw); ieee802154_wake_queue(&local->hw);
rtnl_unlock();
kfree_skb(skb); kfree_skb(skb);
} else { pr_debug("transmission failed\n");
/* Restart the netif queue on each sub_if_data object. */
ieee802154_xmit_complete(&local->hw, skb);
}
} }
static netdev_tx_t static netdev_tx_t
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册