Skip to content

Commit 3c5d45c

Browse files
committed
netfilter: nf_tables: discard table flag update with pending basechain deletion
jira LE-1907 cve CVE-2024-35897 Rebuild_History Non-Buildable kernel-4.18.0-553.16.1.el8_10 commit-author Pablo Neira Ayuso <[email protected]> commit 1bc83a0 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-4.18.0-553.16.1.el8_10/1bc83a01.failed Hook unregistration is deferred to the commit phase, same occurs with hook updates triggered by the table dormant flag. When both commands are combined, this results in deleting a basechain while leaving its hook still registered in the core. Fixes: 179d9ba ("netfilter: nf_tables: fix table flag updates") Signed-off-by: Pablo Neira Ayuso <[email protected]> (cherry picked from commit 1bc83a0) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # net/netfilter/nf_tables_api.c
1 parent e5d0142 commit 3c5d45c

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
netfilter: nf_tables: discard table flag update with pending basechain deletion
2+
3+
jira LE-1907
4+
cve CVE-2024-35897
5+
Rebuild_History Non-Buildable kernel-4.18.0-553.16.1.el8_10
6+
commit-author Pablo Neira Ayuso <[email protected]>
7+
commit 1bc83a019bbe268be3526406245ec28c2458a518
8+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
9+
Will be included in final tarball splat. Ref for failed cherry-pick at:
10+
ciq/ciq_backports/kernel-4.18.0-553.16.1.el8_10/1bc83a01.failed
11+
12+
Hook unregistration is deferred to the commit phase, same occurs with
13+
hook updates triggered by the table dormant flag. When both commands are
14+
combined, this results in deleting a basechain while leaving its hook
15+
still registered in the core.
16+
17+
Fixes: 179d9ba5559a ("netfilter: nf_tables: fix table flag updates")
18+
Signed-off-by: Pablo Neira Ayuso <[email protected]>
19+
(cherry picked from commit 1bc83a019bbe268be3526406245ec28c2458a518)
20+
Signed-off-by: Jonathan Maple <[email protected]>
21+
22+
# Conflicts:
23+
# net/netfilter/nf_tables_api.c
24+
diff --cc net/netfilter/nf_tables_api.c
25+
index 6dfe5eb2c32e,d89d77946719..000000000000
26+
--- a/net/netfilter/nf_tables_api.c
27+
+++ b/net/netfilter/nf_tables_api.c
28+
@@@ -952,8 -1195,30 +952,33 @@@ static void nf_tables_table_disable(str
29+
#define __NFT_TABLE_F_INTERNAL (NFT_TABLE_F_MASK + 1)
30+
#define __NFT_TABLE_F_WAS_DORMANT (__NFT_TABLE_F_INTERNAL << 0)
31+
#define __NFT_TABLE_F_WAS_AWAKEN (__NFT_TABLE_F_INTERNAL << 1)
32+
-#define __NFT_TABLE_F_WAS_ORPHAN (__NFT_TABLE_F_INTERNAL << 2)
33+
#define __NFT_TABLE_F_UPDATE (__NFT_TABLE_F_WAS_DORMANT | \
34+
++<<<<<<< HEAD
35+
+ __NFT_TABLE_F_WAS_AWAKEN)
36+
++=======
37+
+ __NFT_TABLE_F_WAS_AWAKEN | \
38+
+ __NFT_TABLE_F_WAS_ORPHAN)
39+
+
40+
+ static bool nft_table_pending_update(const struct nft_ctx *ctx)
41+
+ {
42+
+ struct nftables_pernet *nft_net = nft_pernet(ctx->net);
43+
+ struct nft_trans *trans;
44+
+
45+
+ if (ctx->table->flags & __NFT_TABLE_F_UPDATE)
46+
+ return true;
47+
+
48+
+ list_for_each_entry(trans, &nft_net->commit_list, list) {
49+
+ if (trans->ctx.table == ctx->table &&
50+
+ ((trans->msg_type == NFT_MSG_NEWCHAIN &&
51+
+ nft_trans_chain_update(trans)) ||
52+
+ (trans->msg_type == NFT_MSG_DELCHAIN &&
53+
+ nft_is_base_chain(trans->ctx.chain))))
54+
+ return true;
55+
+ }
56+
+
57+
+ return false;
58+
+ }
59+
++>>>>>>> 1bc83a019bbe (netfilter: nf_tables: discard table flag update with pending basechain deletion)
60+
61+
static int nf_tables_updtable(struct nft_ctx *ctx)
62+
{
63+
* Unmerged path net/netfilter/nf_tables_api.c

0 commit comments

Comments
 (0)