netfilter: nft_connlimit: fix nft clone() functions
Subsystems (3)
PATCH v2 1/1 netfilter: nft_connlimit: fix nft clone() functions
These NULL checks are reversed so the clone() can never succeed.
---
v2: fix a couple similar bugs
net/netfilter/nft_connlimit.c | 2 +- net/netfilter/nft_last.c | 2 +- net/netfilter/nft_quota.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nft_connlimit.c +1 -1
@@ -206,7 +206,7 @@ static int nft_connlimit_clone(struct nft_expr *dst, const struct nft_expr *src)struct nft_connlimit *priv_src =nft_expr_priv (src); priv_dst->list =kmalloc (sizeof (*priv_dst->list),GFP_ATOMIC ); -if (priv_dst->list) +if (!priv_dst->list)return -ENOMEM ;nf_conncount_list_init (priv_dst->list);
net/netfilter/nft_last.c +1 -1
@@ -106,7 +106,7 @@ static int nft_last_clone(struct nft_expr *dst, const struct nft_expr *src)struct nft_last_priv *priv_dst =nft_expr_priv (dst); priv_dst->last =kzalloc (sizeof (*priv_dst->last),GFP_ATOMIC ); -if (priv_dst->last) +if (!priv_dst->last)return -ENOMEM ;return 0 ;
net/netfilter/nft_quota.c +1 -1
@@ -237,7 +237,7 @@ static int nft_quota_clone(struct nft_expr *dst, const struct nft_expr *src)struct nft_quota *priv_dst =nft_expr_priv (dst); priv_dst->consumed =kmalloc (sizeof (*priv_dst->consumed),GFP_ATOMIC ); -if (priv_dst->consumed) +if (!priv_dst->consumed)return -ENOMEM ;atomic64_set (priv_dst->consumed,0 );
Signature · 1 line
2.20.1
Quoted 6 lines · Dan Carpenter
These NULL checks are reversed so the
clone()can never succeed.Fixes 37f319f37d90 ("netfilter: nft_connlimit: move stateful fields out of expression data")Signed-off-by Dan Carpenter <[email protected]>---
v2: fix a couple similar bugs
Gar. Nope. Missed one still.
regards,
dan carpenter
Pablo Neira Ayuso
maintainerQuoted 9 lines · Dan Carpenter
Quoted 6 lines · Dan Carpenter
These NULL checks are reversed so the
clone()can never succeed.Fixes 37f319f37d90 ("netfilter: nft_connlimit: move stateful fields out of expression data")Signed-off-by Dan Carpenter <[email protected]>---
v2: fix a couple similar bugsGar. Nope. Missed one still.
Already fixed in net-next
Quoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Dan Carpenter
Quoted 2 lines · Dan Carpenter
These NULL checks are reversed so the
clone()can never succeed.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Fixes 37f319f37d90 ("netfilter: nft_connlimit: move stateful fields out of expression data")Signed-off-by Dan Carpenter <[email protected]>---
v2: fix a couple similar bugsGar. Nope. Missed one still.
Already fixed in net-next
Maybe I misunderstood. Are all four functions fixed?
I'm looking at net-next and nft_connlimit_clone() is still broken.
regards,
dan carpenter
Pablo Neira Ayuso
maintainerQuoted 10 lines · Dan Carpenter
Quoted 9 lines · Pablo Neira Ayuso
Quoted 8 lines · Dan Carpenter
Quoted 6 lines · Dan Carpenter
These NULL checks are reversed so the
clone()can never succeed.Fixes 37f319f37d90 ("netfilter: nft_connlimit: move stateful fields out of expression data")Signed-off-by Dan Carpenter <[email protected]>---
v2: fix a couple similar bugs
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Gar. Nope. Missed one still.
Already fixed in net-next
Maybe I misunderstood. Are all four functions fixed?
I'm looking at net-next and
nft_connlimit_clone()is still broken.
Sorry, patch in the net tree:
commit 51edb2ff1c6fc27d3fa73f0773a31597ecd8e230
Author: Pablo Neira Ayuso <[email protected]> Date: Mon Jan 10 20:48:17 2022 +0100
netfilter: nf_tables: typo NULL check in _clone() function
net-next is out of sync at this stage, until merge window reopens it might stay like this.