mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
netfilter: nft_dynset: annotate data-races around set timeout
set timeout can be read locklessly while being updated from control
plane, add annotation.
Fixes: 123b99619c
("netfilter: nf_tables: honor set timeout and garbage collection updates")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
15d8605c0c
commit
c5ad8ed61f
@ -56,7 +56,7 @@ static struct nft_elem_priv *nft_dynset_new(struct nft_set *set,
|
||||
if (!atomic_add_unless(&set->nelems, 1, set->size))
|
||||
return NULL;
|
||||
|
||||
timeout = priv->timeout ? : set->timeout;
|
||||
timeout = priv->timeout ? : READ_ONCE(set->timeout);
|
||||
elem_priv = nft_set_elem_init(set, &priv->tmpl,
|
||||
®s->data[priv->sreg_key], NULL,
|
||||
®s->data[priv->sreg_data],
|
||||
@ -95,7 +95,7 @@ void nft_dynset_eval(const struct nft_expr *expr,
|
||||
expr, regs, &ext)) {
|
||||
if (priv->op == NFT_DYNSET_OP_UPDATE &&
|
||||
nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION)) {
|
||||
timeout = priv->timeout ? : set->timeout;
|
||||
timeout = priv->timeout ? : READ_ONCE(set->timeout);
|
||||
*nft_set_ext_expiration(ext) = get_jiffies_64() + timeout;
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
|
||||
nft_dynset_ext_add_expr(priv);
|
||||
|
||||
if (set->flags & NFT_SET_TIMEOUT) {
|
||||
if (timeout || set->timeout) {
|
||||
if (timeout || READ_ONCE(set->timeout)) {
|
||||
nft_set_ext_add(&priv->tmpl, NFT_SET_EXT_TIMEOUT);
|
||||
nft_set_ext_add(&priv->tmpl, NFT_SET_EXT_EXPIRATION);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user