Commit 9752d6a
netfilter: nf_tables: reject duplicate device on updates
commit cf5fb87 upstream.
A chain/flowtable update with duplicated devices in the same batch is
possible. Unfortunately, netdev event path only removes the first
device that is found, leaving unregistered the hook of the duplicated
device.
Check if a duplicated device exists in the transaction batch, bail out
with EEXIST in such case.
WARNING is hit when unregistering the hook:
[49042.221275] WARNING: CPU: 4 PID: 8425 at net/netfilter/core.c:340 nf_hook_entry_head+0xaa/0x150
[49042.221375] CPU: 4 UID: 0 PID: 8425 Comm: nft Tainted: G S 6.16.0+ torvalds#170 PREEMPT(full)
[...]
[49042.221382] RIP: 0010:nf_hook_entry_head+0xaa/0x150
Fixes: 78d9f48 ("netfilter: nf_tables: add devices to existing flowtable")
Fixes: b9703ed ("netfilter: nf_tables: support for adding new devices to an existing netdev chain")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 636c1f0 commit 9752d6a
1 file changed
+30
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2576 | 2576 | | |
2577 | 2577 | | |
2578 | 2578 | | |
| 2579 | + | |
2579 | 2580 | | |
2580 | 2581 | | |
2581 | 2582 | | |
| |||
2616 | 2617 | | |
2617 | 2618 | | |
2618 | 2619 | | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
2619 | 2634 | | |
2620 | 2635 | | |
2621 | 2636 | | |
| |||
8493 | 8508 | | |
8494 | 8509 | | |
8495 | 8510 | | |
| 8511 | + | |
8496 | 8512 | | |
8497 | 8513 | | |
8498 | 8514 | | |
| |||
8508 | 8524 | | |
8509 | 8525 | | |
8510 | 8526 | | |
| 8527 | + | |
| 8528 | + | |
| 8529 | + | |
| 8530 | + | |
| 8531 | + | |
| 8532 | + | |
| 8533 | + | |
| 8534 | + | |
| 8535 | + | |
| 8536 | + | |
| 8537 | + | |
| 8538 | + | |
| 8539 | + | |
| 8540 | + | |
8511 | 8541 | | |
8512 | 8542 | | |
8513 | 8543 | | |
| |||
0 commit comments