Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac802154: tx: fix synced xmit deadlock

This patch reverts 6001d52 ("mac802154: tx: don't allow if down while
sync tx"). This has side effects with stop callback which flush the
transmit workqueue. The stop callback will wait until the workqueue is
flushed and holding the rtnl lock. That means it can happen that the stop
callback waits forever because it try to lock the rtnl mutex which is
already hold by stop callback.

Cc: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Alexander Aring and committed by
Marcel Holtmann
c3838353 818f1f3e

-12
-3
net/mac802154/driver-ops.h
··· 18 18 static inline int 19 19 drv_xmit_sync(struct ieee802154_local *local, struct sk_buff *skb) 20 20 { 21 - /* don't allow other operations while sync xmit */ 22 - ASSERT_RTNL(); 23 - 24 21 might_sleep(); 25 22 26 23 return local->ops->xmit_sync(&local->hw, skb);
-9
net/mac802154/tx.c
··· 38 38 struct net_device *dev = skb->dev; 39 39 int res; 40 40 41 - rtnl_lock(); 42 - 43 - /* check if ifdown occurred while schedule */ 44 - if (!netif_running(dev)) 45 - goto err_tx; 46 - 47 41 res = drv_xmit_sync(local, skb); 48 42 if (res) 49 43 goto err_tx; ··· 47 53 dev->stats.tx_packets++; 48 54 dev->stats.tx_bytes += skb->len; 49 55 50 - rtnl_unlock(); 51 - 52 56 return; 53 57 54 58 err_tx: 55 59 /* Restart the netif queue on each sub_if_data object. */ 56 60 ieee802154_wake_queue(&local->hw); 57 - rtnl_unlock(); 58 61 kfree_skb(skb); 59 62 netdev_dbg(dev, "transmission failed\n"); 60 63 }