Commit 9b7c0f3
committed
netfilter: nf_tables: Fix potential data-race in __nft_flowtable_type_get()
jira LE-1907
cve CVE-2024-35898
Rebuild_History Non-Buildable kernel-5.14.0-427.33.1.el9_4
commit-author Ziyang Xuan <william.xuanziyang@huawei.com>
commit 2422501
nft_unregister_flowtable_type() within nf_flow_inet_module_exit() can
concurrent with __nft_flowtable_type_get() within nf_tables_newflowtable().
And thhere is not any protection when iterate over nf_tables_flowtables
list in __nft_flowtable_type_get(). Therefore, there is pertential
data-race of nf_tables_flowtables list entry.
Use list_for_each_entry_rcu() to iterate over nf_tables_flowtables list
in __nft_flowtable_type_get(), and use rcu_read_lock() in the caller
nft_flowtable_type_get() to protect the entire type query process.
Fixes: 3b49e2e ("netfilter: nf_tables: add flow table netlink frontend")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit 2422501)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>1 parent 875b368 commit 9b7c0f3
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7912 | 7912 | | |
7913 | 7913 | | |
7914 | 7914 | | |
| 7915 | + | |
7915 | 7916 | | |
7916 | 7917 | | |
7917 | 7918 | | |
7918 | 7919 | | |
7919 | | - | |
| 7920 | + | |
7920 | 7921 | | |
7921 | 7922 | | |
7922 | 7923 | | |
| |||
7928 | 7929 | | |
7929 | 7930 | | |
7930 | 7931 | | |
| 7932 | + | |
7931 | 7933 | | |
7932 | | - | |
| 7934 | + | |
| 7935 | + | |
7933 | 7936 | | |
| 7937 | + | |
| 7938 | + | |
7934 | 7939 | | |
7935 | 7940 | | |
7936 | 7941 | | |
| |||
0 commit comments