[nf PATCH] netfilter: nf_tables: nft_flowtable_find_dev() lacks rcu_read_lock()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <phil@xxxxxx>
---
 net/netfilter/nft_flow_offload.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index ab9576098701..8044dbe58ccf 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -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;
 }
-- 
2.43.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux