Thread (39 messages) 39 messages, 6 authors, 2022-02-28

Re: [PATCH net-next 19/32] netfilter: nft_connlimit: move stateful fields out of expression data

From: Julian Wiedmann <hidden>
Date: 2022-01-10 18:21:00
Also in: netfilter-devel

On 10.01.22 01:16, Pablo Neira Ayuso wrote:
quoted hunk ↗ jump to hunk
In preparation for the rule blob representation.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_connlimit.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/net/netfilter/nft_connlimit.c b/net/netfilter/nft_connlimit.c
index 7d0761fad37e..58dcafe8bf79 100644
--- a/net/netfilter/nft_connlimit.c
+++ b/net/netfilter/nft_connlimit.c
[...]
quoted hunk ↗ jump to hunk
 
 static int nft_connlimit_do_dump(struct sk_buff *skb,
@@ -200,7 +205,11 @@ static int nft_connlimit_clone(struct nft_expr *dst, const struct nft_expr *src)
 	struct nft_connlimit *priv_dst = nft_expr_priv(dst);
 	struct nft_connlimit *priv_src = nft_expr_priv(src);
 
-	nf_conncount_list_init(&priv_dst->list);
+	priv_dst->list = kmalloc(sizeof(*priv_dst->list), GFP_ATOMIC);
+	if (priv_dst->list)
+		return -ENOMEM;
+
+	nf_conncount_list_init(priv_dst->list);
 	priv_dst->limit	 = priv_src->limit;
 	priv_dst->invert = priv_src->invert;
 
Hi Pablo,

Coverity (CID 1510697) spotted a typo in this NULL check, it should be

	if (!priv_dst->list)
		return -ENOMEM;


Looks like the following patches also have this bug.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help