Commit d78d867
netfilter: nf_tables: Fix potential data-race in __nft_obj_type_get()
nft_unregister_obj() can concurrent with __nft_obj_type_get(),
and there is not any protection when iterate over nf_tables_objects
list in __nft_obj_type_get(). Therefore, there is potential data-race
of nf_tables_objects list entry.
Use list_for_each_entry_rcu() to iterate over nf_tables_objects
list in __nft_obj_type_get(), and use rcu_read_lock() in the caller
nft_obj_type_get() to protect the entire type query process.
Fixes: e500924 ("netfilter: nf_tables: add stateful objects")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>1 parent f969eb8 commit d78d867
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7611 | 7611 | | |
7612 | 7612 | | |
7613 | 7613 | | |
7614 | | - | |
| 7614 | + | |
7615 | 7615 | | |
7616 | 7616 | | |
7617 | 7617 | | |
| |||
7627 | 7627 | | |
7628 | 7628 | | |
7629 | 7629 | | |
| 7630 | + | |
7630 | 7631 | | |
7631 | | - | |
| 7632 | + | |
| 7633 | + | |
7632 | 7634 | | |
| 7635 | + | |
| 7636 | + | |
7633 | 7637 | | |
7634 | 7638 | | |
7635 | 7639 | | |
| |||
0 commit comments