netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Eric Woudstra <ericwouds@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v3 nf-next 2/3] netfilter: nf_flow_table_core: teardown direct xmit when destination changed
Date: Mon, 8 Sep 2025 23:56:54 +0200	[thread overview]
Message-ID: <aL9RJtdQJr7t5Z_K@strlen.de> (raw)
In-Reply-To: <20250617070007.23812-3-ericwouds@gmail.com>

Eric Woudstra <ericwouds@gmail.com> wrote:
> +static int nf_flow_table_switchdev_event(struct notifier_block *unused,
> +					 unsigned long event, void *ptr)
> +{
> +	struct switchdev_notifier_fdb_info *fdb_info;
> +	struct nf_flowtable *flowtable;
> +	struct flow_cleanup_data cud;
> +
> +	if (event != SWITCHDEV_FDB_DEL_TO_DEVICE)
> +		return NOTIFY_DONE;
> +
> +	fdb_info = ptr;
> +	cud.addr = fdb_info->addr;
> +	cud.vid = fdb_info->vid;
> +	cud.ifindex = fdb_info->info.dev->ifindex;
> +
> +	mutex_lock(&flowtable_lock);

Please always test your patches with lockdep enabled,
this doesn't work.  Switchdev notifiers are atomic.

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:575
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1570, name: kworker/u32:8
preempt_count: 201, expected: 0
RCU nest depth: 1, expected: 0
6 locks held by kworker/u32:8/1570:
 #0: ffff88810032b948 ((wq_completion)netns){+.+.}-{0:0}, at: process_scheduled_works+0x8d7/0x1460
 #1: ffffc900021e7ba0 (net_cleanup_work){+.+.}-{0:0}, at: process_scheduled_works+0x912/0x1460
 #2: ffffffff848d1eb0 (pernet_ops_rwsem){++++}-{4:4}, at: cleanup_net+0xf8/0x7b0
 #3: ffffffff848de6e8 (rtnl_mutex){+.+.}-{4:4}, at: ops_undo_list+0x270/0x860
 #4: ffff88811f1f8bd8 (&br->hash_lock){+...}-{3:3}, at: br_fdb_delete_by_port+0x3b/0x290
 #5: ffffffff8457a800 (rcu_read_lock){....}-{1:3}, at: atomic_notifier_call_chain+0x27/0x150
Workqueue: netns cleanup_net
Call Trace:
 __mutex_lock+0xf5/0x14f0
  nf_flow_table_switchdev_event+0x104/0x270
 atomic_notifier_call_chain+0xc5/0x150
 br_switchdev_fdb_notify+0x2b2/0x330
...

  reply	other threads:[~2025-09-08 21:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  7:00 [PATCH v3 nf-next 0/3] flow offload teardown when layer 2 roaming Eric Woudstra
2025-06-17  7:00 ` [PATCH v3 nf-next 1/3] netfilter: flow: Add bridge_vid member Eric Woudstra
2025-06-17  7:00 ` [PATCH v3 nf-next 2/3] netfilter: nf_flow_table_core: teardown direct xmit when destination changed Eric Woudstra
2025-09-08 21:56   ` Florian Westphal [this message]
2025-06-17  7:00 ` [PATCH v3 nf-next 3/3] netfilter: nf_flow_table_ip: don't follow fastpath when marked teardown Eric Woudstra
2025-09-08 21:06   ` Pablo Neira Ayuso
2025-09-02  8:58 ` [PATCH v3 nf-next 0/3] flow offload teardown when layer 2 roaming Eric Woudstra
2025-09-02 12:32   ` Florian Westphal

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=aL9RJtdQJr7t5Z_K@strlen.de \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ericwouds@gmail.com \
    --cc=horms@kernel.org \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=razor@blackwall.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).