From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v5 net-next 5/9] net: dsa: netc: use entry ID instead of pointer to track host flood rule
Date: Tue, 13 Oct 2026 09:59:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-169416@kernel.org> (raw)
In-Reply-To: <20261012095924.1129312-6-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] netc: Sleeping in Atomic Context during port_set_host_flood
--
commit ec5410333ea86338656a97517d41df973b9cde3c
Author: Wei Fang <wei.fang@nxp.com>
net: dsa: netc: use entry ID instead of pointer to track host flood rule
Replace the struct ipft_entry_data pointer in struct netc_port with a
plain u32 entry ID (ipft_hf_eid), using NTMP_NULL_ENTRY_ID as the
sentinel value. The ipft_entry_data allocation is now freed immediately
inside netc_port_add_host_flood_rule() after the hardware entry is
committed, so no heap memory survives beyond that function. As a result,
netc_free_host_flood_rules() is no longer needed and can be removed.
> diff --git a/drivers/net/dsa/netc/netc_main.c b/drivers/net/dsa/netc/netc_main.c
> index c639ae67c9b71..e33a184fd0054 100644
> --- a/drivers/net/dsa/netc/netc_main.c
> +++ b/drivers/net/dsa/netc/netc_main.c
[ ... ]
> @@ -1890,7 +1876,7 @@ static void netc_port_set_host_flood(struct dsa_switch *ds, int port,
> bool uc, bool mc)
> {
> struct netc_port *np = NETC_PORT(ds, port);
> - struct ipft_entry_data *old_host_flood;
> + u32 old_entry_id;
>
> /* Do not add host flood rule to ingress port filter table when
> * the port has joined a bridge. Otherwise, the ingress frames
> @@ -1898,7 +1884,7 @@ static void netc_port_set_host_flood(struct dsa_switch *ds, int port,
> * will be redirected directly to the CPU port.
> */
> if (dsa_port_bridge_dev_get(np->dp)) {
> - netc_port_remove_host_flood(np, np->host_flood);
> + netc_port_remove_host_flood(np, np->ipft_hf_eid);
>
> return;
> }
> @@ -1908,20 +1894,18 @@ static void netc_port_set_host_flood(struct dsa_switch *ds, int port,
>
> /* IPFT does not support in-place updates to the KEYE element,
> * we need to add a new entry and then delete the old one. So
> - * save the old entry first.
> + * save the old entry ID first.
> */
> - old_host_flood = np->host_flood;
> - np->host_flood = NULL;
> + old_entry_id = np->ipft_hf_eid;
>
> if (netc_port_add_host_flood_rule(np, uc, mc)) {
[Severity: High]
Does this code sleep in atomic context?
The port_set_host_flood callback in DSA drivers is invoked via
ndo_change_rx_flags (e.g., when toggling promiscuous or allmulti mode on the
interface). The networking core holds netif_addr_lock_bh() during this
operation, creating an atomic context where sleeping is prohibited.
However, netc_port_set_host_flood() calls netc_port_add_host_flood_rule(),
which performs a sleepable allocation:
host_flood = kzalloc_obj(*host_flood);
Additionally, it calls ntmp_ipft_add_entry(), which allocates a DMA buffer
using dma_alloc_coherent() with GFP_KERNEL and calls read_poll_timeout()
with a 10us sleep (usleep_range). Executing these sleepable operations while
holding a spinlock with BH disabled will trigger a sleeping-in-atomic panic.
> - np->host_flood = old_host_flood;
> dev_err(ds->dev, "Failed to add host flood rule on port %d\n",
> port);
> return;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261012095924.1129312-1-wei.fang@oss.nxp.com?part=5
next prev parent reply other threads:[~2026-10-13 9:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 9:59 [PATCH v5 net-next 0/9] net: dsa: netc: add PTP support for NETC switch wei.fang
2026-10-12 9:59 ` [PATCH v5 net-next 1/9] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access wei.fang
2026-10-12 9:59 ` [PATCH v5 net-next 2/9] ptp: netc: remove unnecessary pcie_flr() call in probe wei.fang
2026-10-12 9:59 ` [PATCH v5 net-next 3/9] ptp: netc: export netc_timer_get_current_time() for cross-driver use wei.fang
2026-10-12 9:59 ` [PATCH v5 net-next 4/9] net: dsa: netc: tie setup resources and reset to DSA setup/teardown wei.fang
2026-10-13 9:59 ` sashiko-bot
2026-10-14 2:23 ` Wei Fang (OSS)
2026-10-13 10:57 ` netdev-bot+sashiko
2026-10-14 6:44 ` Wei Fang (OSS)
2026-10-12 9:59 ` [PATCH v5 net-next 5/9] net: dsa: netc: use entry ID instead of pointer to track host flood rule wei.fang
2026-10-13 9:59 ` sashiko-bot [this message]
2026-10-14 6:26 ` Wei Fang (OSS)
2026-10-12 9:59 ` [PATCH v5 net-next 6/9] net: dsa: netc: check return value of ntmp_ipft_delete_entry() wei.fang
2026-10-13 10:57 ` netdev-bot+sashiko
2026-10-12 9:59 ` [PATCH v5 net-next 7/9] net: dsa: netc: enable ingress port filtering lookup by default wei.fang
2026-10-12 9:59 ` [PATCH v5 net-next 8/9] net: dsa: netc: add PTP two-step timestamping support wei.fang
2026-10-13 9:59 ` sashiko-bot
2026-10-13 10:57 ` netdev-bot+sashiko
2026-10-12 9:59 ` [PATCH v5 net-next 9/9] net: dsa: netc: add PTP one-step " wei.fang
2026-10-13 9:59 ` sashiko-bot
2026-10-13 10:57 ` netdev-bot+sashiko
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=sashiko-outbox-169416@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@oss.nxp.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