Commit 2422501
netfilter: nf_tables: Fix potential data-race in __nft_flowtable_type_get()
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>1 parent 994209d commit 2422501
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8296 | 8296 | | |
8297 | 8297 | | |
8298 | 8298 | | |
| 8299 | + | |
8299 | 8300 | | |
8300 | 8301 | | |
8301 | 8302 | | |
8302 | 8303 | | |
8303 | | - | |
| 8304 | + | |
8304 | 8305 | | |
8305 | 8306 | | |
8306 | 8307 | | |
| |||
8312 | 8313 | | |
8313 | 8314 | | |
8314 | 8315 | | |
| 8316 | + | |
8315 | 8317 | | |
8316 | | - | |
| 8318 | + | |
| 8319 | + | |
8317 | 8320 | | |
| 8321 | + | |
| 8322 | + | |
8318 | 8323 | | |
8319 | 8324 | | |
8320 | 8325 | | |
| |||
0 commit comments