From: Andrew Gaylard <ag@ffroot.co.za>
To: netdev@vger.kernel.org
Cc: wellslutw@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
linux-arm-kernel@lists.infradead.org,
Andrew Gaylard <ag@ffroot.co.za>
Subject: [PATCH] net: sunplus: fix tx_poll spin_lock missing irqsave in NAPI context
Date: Thu, 20 Aug 2026 15:01:59 +0200 [thread overview]
Message-ID: <20260820130159.1584806-1-ag@ffroot.co.za> (raw)
spl2sw_tx_poll() runs in NAPI (softirq) context and acquires
comm->tx_lock with plain spin_lock(). The hardirq handler
spl2sw_ethernet_interrupt() acquires the same lock, so a hardirq on
the same CPU while the NAPI poll holds the lock would deadlock with
IRQs disabled. Use spin_lock_irqsave/spin_unlock_irqrestore.
Signed-off-by: Andrew Gaylard <ag@ffroot.co.za>
---
drivers/net/ethernet/sunplus/spl2sw_int.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/sunplus/spl2sw_int.c b/drivers/net/ethernet/sunplus/spl2sw_int.c
index a37c9a4c281f..7e07cd941434 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_int.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_int.c
@@ -147,7 +147,7 @@ int spl2sw_tx_poll(struct napi_struct *napi, int budget)
u32 cmd;
int i;
- spin_lock(&comm->tx_lock);
+ spin_lock_irqsave(&comm->tx_lock, flags);
tx_done_pos = comm->tx_done_pos;
while (((tx_done_pos != comm->tx_pos) || (comm->tx_desc_full == 1)) && budget_left) {
@@ -196,7 +196,7 @@ int spl2sw_tx_poll(struct napi_struct *napi, int budget)
if (netif_queue_stopped(comm->ndev[i]))
netif_wake_queue(comm->ndev[i]);
- spin_unlock(&comm->tx_lock);
+ spin_unlock_irqrestore(&comm->tx_lock, flags);
spin_lock_irqsave(&comm->int_mask_lock, flags);
mask = readl(comm->l2sw_reg_base + L2SW_SW_INT_MASK_0);
--
2.53.0
reply other threads:[~2026-08-20 13:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260820130159.1584806-1-ag@ffroot.co.za \
--to=ag@ffroot.co.za \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wellslutw@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox