[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aL9RJtdQJr7t5Z_K@strlen.de>
Date: Mon, 8 Sep 2025 23:56:54 +0200
From: Florian Westphal <fw@...len.de>
To: Eric Woudstra <ericwouds@...il.com>
Cc: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Nikolay Aleksandrov <razor@...ckwall.org>,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v3 nf-next 2/3] netfilter: nf_flow_table_core: teardown
direct xmit when destination changed
Eric Woudstra <ericwouds@...il.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
...
Powered by blists - more mailing lists