[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150131042920.GA27480@gondor.apana.org.au>
Date: Sat, 31 Jan 2015 15:29:20 +1100
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Patrick McHardy <kaber@...sh.net>
Cc: tgraf@...g.ch, davem@...emloft.net, David.Laight@...LAB.COM,
ying.xue@...driver.com, paulmck@...ux.vnet.ibm.com,
netdev@...r.kernel.org, netfilter-devel@...r.kernel.org
Subject: Re: [PATCH 7/9] netfilter: nft_hash: add support for timeouts
On Fri, Jan 30, 2015 at 07:46:32AM +0000, Patrick McHardy wrote:
>
> + mutex_lock(&priv->ht.mutex);
> + tbl = rht_dereference(priv->ht.tbl, &priv->ht);
> + for (i = 0; i < tbl->size; i++) {
> + rht_for_each_entry_safe(he, pos, next, tbl, i, node) {
> + if (!nft_set_ext_exists(&he->ext, NFT_SET_EXT_TIMEOUT))
> + continue;
> + timeout = *nft_set_ext_timeout(&he->ext);
> + if (time_before(jiffies, timeout))
> + continue;
> +
> + rhashtable_remove(&priv->ht, &he->node);
> + nft_hash_elem_destroy(set, he);
> + }
> + }
> + mutex_unlock(&priv->ht.mutex);
What if somebody is currently walking over the table? Shouldn't
you do an RCU free here instead of immediately destroying the
element?
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists