mirror of https://github.com/torvalds/linux.git
netfilter: nft_connlimit: fix possible data race on connection count
nft_connlimit_eval() reads priv->list->count to check if the connection
limit has been exceeded. This value is being read without a lock and can
be modified by a different process. Use READ_ONCE() for correctness.
Fixes: df4a902509 ("netfilter: nf_conncount: merge lookup and add functions")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
This commit is contained in:
parent
514f1dc8f2
commit
8d96dfdcab
|
|
@ -48,7 +48,7 @@ static inline void nft_connlimit_do_eval(struct nft_connlimit *priv,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = priv->list->count;
|
count = READ_ONCE(priv->list->count);
|
||||||
|
|
||||||
if ((count > priv->limit) ^ priv->invert) {
|
if ((count > priv->limit) ^ priv->invert) {
|
||||||
regs->verdict.code = NFT_BREAK;
|
regs->verdict.code = NFT_BREAK;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue