* [PATCH v2] netfilter: nft_connlimit: fix nft clone() functions
@ 2022-01-11 7:21 Dan Carpenter
2022-01-11 7:45 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2022-01-11 7:21 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Jozsef Kadlecsik, Florian Westphal, netfilter-devel, coreteam,
kernel-janitors
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 <dan.carpenter@oracle.com>
---
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(-)
diff --git a/net/netfilter/nft_connlimit.c b/net/netfilter/nft_connlimit.c
index 58dcafe8bf79..7d00a1452b1d 100644
--- a/net/netfilter/nft_connlimit.c
+++ b/net/netfilter/nft_connlimit.c
@@ -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);
diff --git a/net/netfilter/nft_last.c b/net/netfilter/nft_last.c
index 5ee33d0ccd4e..4f745a409d34 100644
--- a/net/netfilter/nft_last.c
+++ b/net/netfilter/nft_last.c
@@ -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;
diff --git a/net/netfilter/nft_quota.c b/net/netfilter/nft_quota.c
index 0484aef74273..f394a0b562f6 100644
--- a/net/netfilter/nft_quota.c
+++ b/net/netfilter/nft_quota.c
@@ -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);
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] netfilter: nft_connlimit: fix nft clone() functions
2022-01-11 7:21 [PATCH v2] netfilter: nft_connlimit: fix nft clone() functions Dan Carpenter
@ 2022-01-11 7:45 ` Dan Carpenter
2022-01-11 9:33 ` Pablo Neira Ayuso
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2022-01-11 7:45 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Jozsef Kadlecsik, Florian Westphal, netfilter-devel, coreteam,
kernel-janitors
On Tue, Jan 11, 2022 at 10:21:15AM +0300, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>
> ---
> v2: fix a couple similar bugs
Gar. Nope. Missed one still.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] netfilter: nft_connlimit: fix nft clone() functions
2022-01-11 7:45 ` Dan Carpenter
@ 2022-01-11 9:33 ` Pablo Neira Ayuso
2022-01-12 6:26 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Pablo Neira Ayuso @ 2022-01-11 9:33 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jozsef Kadlecsik, Florian Westphal, netfilter-devel, coreteam,
kernel-janitors
On Tue, Jan 11, 2022 at 10:45:05AM +0300, Dan Carpenter wrote:
> On Tue, Jan 11, 2022 at 10:21:15AM +0300, Dan Carpenter wrote:
> > 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 <dan.carpenter@oracle.com>
> > ---
> > v2: fix a couple similar bugs
>
> Gar. Nope. Missed one still.
Already fixed in net-next
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] netfilter: nft_connlimit: fix nft clone() functions
2022-01-11 9:33 ` Pablo Neira Ayuso
@ 2022-01-12 6:26 ` Dan Carpenter
2022-01-12 11:11 ` Pablo Neira Ayuso
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2022-01-12 6:26 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Jozsef Kadlecsik, Florian Westphal, netfilter-devel, coreteam,
kernel-janitors
On Tue, Jan 11, 2022 at 10:33:41AM +0100, Pablo Neira Ayuso wrote:
> On Tue, Jan 11, 2022 at 10:45:05AM +0300, Dan Carpenter wrote:
> > On Tue, Jan 11, 2022 at 10:21:15AM +0300, Dan Carpenter wrote:
> > > 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 <dan.carpenter@oracle.com>
> > > ---
> > > v2: fix a couple similar bugs
> >
> > 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.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] netfilter: nft_connlimit: fix nft clone() functions
2022-01-12 6:26 ` Dan Carpenter
@ 2022-01-12 11:11 ` Pablo Neira Ayuso
0 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2022-01-12 11:11 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jozsef Kadlecsik, Florian Westphal, netfilter-devel, coreteam,
kernel-janitors
On Wed, Jan 12, 2022 at 09:26:57AM +0300, Dan Carpenter wrote:
> On Tue, Jan 11, 2022 at 10:33:41AM +0100, Pablo Neira Ayuso wrote:
> > On Tue, Jan 11, 2022 at 10:45:05AM +0300, Dan Carpenter wrote:
> > > On Tue, Jan 11, 2022 at 10:21:15AM +0300, Dan Carpenter wrote:
> > > > 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 <dan.carpenter@oracle.com>
> > > > ---
> > > > v2: fix a couple similar bugs
> > >
> > > 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 <pablo@netfilter.org>
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-12 11:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 7:21 [PATCH v2] netfilter: nft_connlimit: fix nft clone() functions Dan Carpenter
2022-01-11 7:45 ` Dan Carpenter
2022-01-11 9:33 ` Pablo Neira Ayuso
2022-01-12 6:26 ` Dan Carpenter
2022-01-12 11:11 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.