Re: [syzbot] [net?] possible deadlock in sch_direct_xmit

From: syzbot
Date: Sun Nov 26 2023 - 04:47:06 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: [net?] possible deadlock in sch_direct_xmit
Author: eadavis@xxxxxx

please test deadlock in sch_direct_xmit

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 4195a4bc26ca..d9d39887a550 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -337,13 +337,16 @@ bool sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
#endif

if (likely(skb)) {
- HARD_TX_LOCK(dev, txq, smp_processor_id());
- if (!netif_xmit_frozen_or_stopped(txq))
+ if (!netif_xmit_frozen_or_stopped(txq)) {
+ HARD_TX_LOCK(dev, txq, smp_processor_id());
+ netif_tx_stop_queue(txq);
skb = dev_hard_start_xmit(skb, dev, txq, &ret);
+ netif_tx_start_queue(txq);
+ HARD_TX_UNLOCK(dev, txq);
+ }
else
qdisc_maybe_clear_missed(q, txq);

- HARD_TX_UNLOCK(dev, txq);
} else {
if (root_lock)
spin_lock(root_lock);