netfilter: nf_tables: nft_flowtable_find_dev() lacks rcu_read_lock()
Subsystems (2)
Phil Sutter
reviewerPATCH 1/1 netfilter: nf_tables: nft_flowtable_find_dev() lacks rcu_read_lock()
Make sure writers won't free the current hook being dereferenced.
Fixes c63a7cc4d795 ("netfilter: flowtable: use dev_fill_forward_path() to obtain ingress device")
Signed-off-by Phil Sutter <[email protected]>
--- net/netfilter/nft_flow_offload.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nft_flow_offload.c +2 -0
@@ -173,6 +173,7 @@ static bool nft_flowtable_find_dev(const struct net_device *dev,struct nft_hook *hook;bool found = false; +rcu_read_lock ();list_for_each_entry_rcu (hook, &ft->hook_list, list) {if (hook->ops.dev != dev)continue ;
@@ -180,6 +181,7 @@ static bool nft_flowtable_find_dev(const struct net_device *dev, found = true;break ; } +rcu_read_unlock ();return found; }
Signature · 1 line
2.43.0
Florian Westphal
maintainerQuoted 1 line · Phil Sutter
Make sure writers won't free the current hook being dereferenced.
Are you sure?
AFAICS its only called from eval function/hook plane, those are already rcu locked.
Phil Sutter
reviewerQuoted 6 lines · Florian Westphal
Quoted 1 line · Phil Sutter
Make sure writers won't free the current hook being dereferenced.
Are you sure?
AFAICS its only called from eval function/hook plane, those are already rcu locked.
Oh, right! I missed the fact that nf_hook() takes care of it already.
So please discard this patch, it's worthless.
Thanks, Phil