Skip to content

Commit a2d8818

Browse files
TaeheeYooummakynes
authored andcommitted
netfilter: nf_tables: use rhashtable_lookup() instead of rhashtable_lookup_fast()
Internally, rhashtable_lookup_fast() calls rcu_read_lock() then, calls rhashtable_lookup(). so that in places where are guaranteed by rcu read lock, rhashtable_lookup() is enough. Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 28c5ed2 commit a2d8818

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎net/netfilter/nf_flow_table_core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ flow_offload_lookup(struct nf_flowtable *flow_table,
233233
struct flow_offload *flow;
234234
int dir;
235235

236-
tuplehash = rhashtable_lookup_fast(&flow_table->rhashtable, tuple,
237-
nf_flow_offload_rhash_params);
236+
tuplehash = rhashtable_lookup(&flow_table->rhashtable, tuple,
237+
nf_flow_offload_rhash_params);
238238
if (!tuplehash)
239239
return NULL;
240240

‎net/netfilter/nft_set_hash.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static bool nft_rhash_lookup(const struct net *net, const struct nft_set *set,
8888
.key = key,
8989
};
9090

91-
he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
91+
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
9292
if (he != NULL)
9393
*ext = &he->ext;
9494

@@ -106,7 +106,7 @@ static void *nft_rhash_get(const struct net *net, const struct nft_set *set,
106106
.key = elem->key.val.data,
107107
};
108108

109-
he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
109+
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
110110
if (he != NULL)
111111
return he;
112112

@@ -129,7 +129,7 @@ static bool nft_rhash_update(struct nft_set *set, const u32 *key,
129129
.key = key,
130130
};
131131

132-
he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
132+
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
133133
if (he != NULL)
134134
goto out;
135135

@@ -217,7 +217,7 @@ static void *nft_rhash_deactivate(const struct net *net,
217217
};
218218

219219
rcu_read_lock();
220-
he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
220+
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
221221
if (he != NULL &&
222222
!nft_rhash_flush(net, set, he))
223223
he = NULL;

0 commit comments

Comments
 (0)