Commit ddc653d
committed
netfilter: nf_tables: fix table flag updates
jira VUlN-597
subsystem-sync netfilter:nf_tables 4.18.0-511
commit-author Pablo Neira Ayuso <pablo@netfilter.org>
commit 179d9ba
upstream-diff Again some cruft around an upstream commit that Red Hat
did not take - using branch 8_10 as the source of truth for the commit.
The dormant flag need to be updated from the preparation phase,
otherwise, two consecutive requests to dorm a table in the same batch
might try to remove the same hooks twice, resulting in the following
warning:
hook not found, pf 3 num 0
WARNING: CPU: 0 PID: 334 at net/netfilter/core.c:480 __nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480
Modules linked in:
CPU: 0 PID: 334 Comm: kworker/u4:5 Not tainted 5.12.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
RIP: 0010:__nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480
This patch is a partial revert of 0ce7cf4 ("netfilter: nftables:
update table flags from the commit phase") to restore the previous
behaviour.
However, there is still another problem: A batch containing a series of
dorm-wakeup-dorm table and vice-versa also trigger the warning above
since hook unregistration happens from the preparation phase, while hook
registration occurs from the commit phase.
To fix this problem, this patch adds two internal flags to annotate the
original dormant flag status which are __NFT_TABLE_F_WAS_DORMANT and
__NFT_TABLE_F_WAS_AWAKEN, to restore it from the abort path.
The __NFT_TABLE_F_UPDATE bitmask allows to handle the dormant flag update
with one single transaction.
Reported-by: syzbot+7ad5cd1615f2d89c6e7e@syzkaller.appspotmail.com
Fixes: 0ce7cf4 ("netfilter: nftables: update table flags from the commit phase")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit 179d9ba)
Signed-off-by: Greg Rose <g.v.rose@ciq.com>1 parent eeff826 commit ddc653d
File tree
2 files changed
+40
-25
lines changed- include/net/netfilter
- net/netfilter
2 files changed
+40
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1449 | 1449 | | |
1450 | 1450 | | |
1451 | 1451 | | |
1452 | | - | |
1453 | | - | |
1454 | 1452 | | |
1455 | 1453 | | |
1456 | 1454 | | |
1457 | 1455 | | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
1462 | 1456 | | |
1463 | 1457 | | |
1464 | 1458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
742 | | - | |
| 742 | + | |
| 743 | + | |
743 | 744 | | |
744 | 745 | | |
745 | 746 | | |
| |||
942 | 943 | | |
943 | 944 | | |
944 | 945 | | |
| 946 | + | |
945 | 947 | | |
| 948 | + | |
946 | 949 | | |
947 | 950 | | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
953 | 956 | | |
954 | 957 | | |
955 | 958 | | |
956 | 959 | | |
957 | 960 | | |
958 | | - | |
| 961 | + | |
959 | 962 | | |
960 | 963 | | |
961 | 964 | | |
| |||
974 | 977 | | |
975 | 978 | | |
976 | 979 | | |
977 | | - | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
978 | 983 | | |
979 | 984 | | |
980 | | - | |
981 | | - | |
982 | | - | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
983 | 993 | | |
984 | | - | |
985 | | - | |
986 | 994 | | |
987 | | - | |
988 | 995 | | |
989 | 996 | | |
| 997 | + | |
990 | 998 | | |
991 | | - | |
| 999 | + | |
| 1000 | + | |
992 | 1001 | | |
993 | 1002 | | |
994 | 1003 | | |
| |||
8231 | 8240 | | |
8232 | 8241 | | |
8233 | 8242 | | |
8234 | | - | |
| 8243 | + | |
| 8244 | + | |
| 8245 | + | |
| 8246 | + | |
| 8247 | + | |
8235 | 8248 | | |
8236 | 8249 | | |
8237 | | - | |
| 8250 | + | |
8238 | 8251 | | |
8239 | 8252 | | |
8240 | 8253 | | |
| |||
8456 | 8469 | | |
8457 | 8470 | | |
8458 | 8471 | | |
8459 | | - | |
| 8472 | + | |
| 8473 | + | |
| 8474 | + | |
| 8475 | + | |
| 8476 | + | |
8460 | 8477 | | |
8461 | | - | |
| 8478 | + | |
| 8479 | + | |
| 8480 | + | |
| 8481 | + | |
| 8482 | + | |
8462 | 8483 | | |
8463 | 8484 | | |
8464 | 8485 | | |
| |||
0 commit comments