All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+e18ac85757292b7baf96@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [net?] possible deadlock in sch_direct_xmit
Date: Mon, 27 Nov 2023 04:10:00 -0800	[thread overview]
Message-ID: <0000000000006d859a060b212e83@google.com> (raw)
In-Reply-To: <000000000000f2771905a46374fe@google.com>

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

***

Subject: [net?] possible deadlock in sch_direct_xmit
Author: eadavis@qq.com

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..9e418f94757d 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))
-			skb = dev_hard_start_xmit(skb, dev, txq, &ret);
-		else
-			qdisc_maybe_clear_missed(q, txq);
+		int cpu = smp_processor_id();
+		if (READ_ONCE(txq->xmit_lock_owner) != cpu) {
+			HARD_TX_LOCK(dev, txq, cpu);
+			if (!netif_xmit_frozen_or_stopped(txq))
+				skb = dev_hard_start_xmit(skb, dev, txq, &ret);
+			else
+				qdisc_maybe_clear_missed(q, txq);
 
-		HARD_TX_UNLOCK(dev, txq);
+			HARD_TX_UNLOCK(dev, txq);
+		}
 	} else {
 		if (root_lock)
 			spin_lock(root_lock);


      parent reply	other threads:[~2023-11-27 12:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  0:59 possible deadlock in sch_direct_xmit (2) syzbot
2021-10-29  2:08 ` [syzbot] " syzbot
2023-11-24  0:38 ` [syzbot] [net?] " syzbot
2023-11-26  6:50 ` [syzbot] [net?] possible deadlock in sch_direct_xmit syzbot
2023-11-26  9:46 ` syzbot
2023-11-27 12:10 ` syzbot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0000000000006d859a060b212e83@google.com \
    --to=syzbot+e18ac85757292b7baf96@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.