All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kassey Li <quic_yingangl@quicinc.com>
To: davem@davemloft.net, edumazet@google.com
Cc: Kassey Li <quic_yingangl@quicinc.com>,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org
Subject: [PATCH] net: disable irq in napi_poll
Date: Wed, 15 Feb 2023 15:20:46 +0800	[thread overview]
Message-ID: <20230215072046.4000-1-quic_yingangl@quicinc.com> (raw)

There is list_del action in napi_poll, fix race condition by
disable irq.

similar report:
https://syzkaller.appspot.com/bug?id=309955e7f02812d7bfb828c22b517349d9f068
bc

list_del corruption. next->prev should be ffffff88ea0bd4c0, but was
ffffff8a787099c0
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:56!

pstate: 62400005 (nZCv daif +PAN -UAO +TCO -DIT -SSBS BTYPE=--)
pc : __list_del_entry_valid+0xa8/0xac
lr : __list_del_entry_valid+0xa8/0xac
sp : ffffffc0081bbce0
x29: ffffffc0081bbce0 x28: 0000000000000018 x27: 0000000000000059
x26: ffffffef130c6040 x25: ffffffc0081bbcf0 x24: ffffffc0081bbd00
x23: 000000010003d37f x22: 000000000000012c x21: ffffffef130c9000
x20: ffffff8a786cf9c0 x19: ffffff88ea0bd4c0 x18: ffffffc00816d030
x17: ffffffffffffffff x16: 0000000000000004 x15: 0000000000000004
x14: ffffffef131bae30 x13: 0000000000002b84 x12: 0000000000000003
x11: 0000000100002b84 x10: c000000100002b84 x9 : 1f2ede939758e700
x8 : 1f2ede939758e700 x7 : 205b5d3330383232 x6 : 302e33303331205b
x5 : ffffffef13750358 x4 : ffffffc0081bb9df x3 : 0000000000000000
x2 : ffffff8a786be9c8 x1 : 0000000000000000 x0 : 000000000000007c

Call trace:
__list_del_entry_valid+0xa8/0xac
net_rx_action+0xfc/0x3a0
_stext+0x174/0x5f4
run_ksoftirqd+0x34/0x74
smpboot_thread_fn+0x1d8/0x464
kthread+0x168/0x1dc
ret_from_fork+0x10/0x20
Code: d4210000 f000cbc0 91161000 97de537a (d4210000)
---[ end trace 8b3858d55ee59b7c ]---
Kernel panic - not syncing: Oops - BUG: Fatal exception in interrupt

Signed-off-by: Kassey Li <quic_yingangl@quicinc.com>
---
 net/core/dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index b76fb37b381e..0c677a563232 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6660,7 +6660,9 @@ static __latent_entropy void net_rx_action(struct softirq_action *h)
 		}
 
 		n = list_first_entry(&list, struct napi_struct, poll_list);
+		local_irq_disable();
 		budget -= napi_poll(n, &repoll);
+		local_irq_enable();
 
 		/* If softirq window is exhausted then punt.
 		 * Allow this to run for 2 jiffies since which will allow
-- 
2.17.1


             reply	other threads:[~2023-02-15  7:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  7:20 Kassey Li [this message]
2023-02-15  8:32 ` [PATCH] net: disable irq in napi_poll Eric Dumazet
2023-02-17  6:36   ` Kassey Li
2023-02-21 16:41 ` kernel test robot

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=20230215072046.4000-1-quic_yingangl@quicinc.com \
    --to=quic_yingangl@quicinc.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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.