Skip to content

Commit 8d96dfd

Browse files
ffmanceraFlorian Westphal
authored andcommitted
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: df4a902 ("netfilter: nf_conncount: merge lookup and add functions") Signed-off-by: Fernando Fernandez Mancera <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent 514f1dc commit 8d96dfd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/netfilter/nft_connlimit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static inline void nft_connlimit_do_eval(struct nft_connlimit *priv,
4848
return;
4949
}
5050

51-
count = priv->list->count;
51+
count = READ_ONCE(priv->list->count);
5252

5353
if ((count > priv->limit) ^ priv->invert) {
5454
regs->verdict.code = NFT_BREAK;

0 commit comments

Comments
 (0)