Commit b38a133
netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get()
[ Upstream commit f969eb8 ]
nft_unregister_expr() can concurrent with __nft_expr_type_get(),
and there is not any protection when iterate over nf_tables_expressions
list in __nft_expr_type_get(). Therefore, there is potential data-race
of nf_tables_expressions list entry.
Use list_for_each_entry_rcu() to iterate over nf_tables_expressions
list in __nft_expr_type_get(), and use rcu_read_lock() in the caller
nft_expr_type_get() to protect the entire type query process.
Fixes: ef1f7df ("netfilter: nf_tables: expression ops overloading")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 2450a69 commit b38a133
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2239 | 2239 | | |
2240 | 2240 | | |
2241 | 2241 | | |
2242 | | - | |
| 2242 | + | |
2243 | 2243 | | |
2244 | 2244 | | |
2245 | 2245 | | |
| |||
2271 | 2271 | | |
2272 | 2272 | | |
2273 | 2273 | | |
| 2274 | + | |
2274 | 2275 | | |
2275 | | - | |
| 2276 | + | |
| 2277 | + | |
2276 | 2278 | | |
| 2279 | + | |
| 2280 | + | |
2277 | 2281 | | |
2278 | 2282 | | |
2279 | 2283 | | |
| |||
0 commit comments