netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats allocation
@ 2014-10-21  9:08 Sabrina Dubroca
  2014-10-22 12:09 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Sabrina Dubroca @ 2014-10-21  9:08 UTC (permalink / raw)
  To: pablo, kaber, kadlec; +Cc: netfilter-devel, coreteam, netdev

alloc_percpu returns NULL on failure, not a negative error code.

Fixes: ff3cd7b3c922 ("netfilter: nf_tables: refactor chain statistic routines")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
 net/netfilter/nf_tables_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 556a0dfa4abc..eb123676e1ef 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1328,10 +1328,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
 			basechain->stats = stats;
 		} else {
 			stats = netdev_alloc_pcpu_stats(struct nft_stats);
-			if (IS_ERR(stats)) {
+			if (stats == NULL) {
 				module_put(type->owner);
 				kfree(basechain);
-				return PTR_ERR(stats);
+				return -ENOMEM;
 			}
 			rcu_assign_pointer(basechain->stats, stats);
 		}
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf] netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats allocation
  2014-10-21  9:08 [PATCH nf] netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats allocation Sabrina Dubroca
@ 2014-10-22 12:09 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-10-22 12:09 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: kaber, kadlec, netfilter-devel, coreteam, netdev

On Tue, Oct 21, 2014 at 11:08:21AM +0200, Sabrina Dubroca wrote:
> alloc_percpu returns NULL on failure, not a negative error code.

Good catch. Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-22 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-21  9:08 [PATCH nf] netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats allocation Sabrina Dubroca
2014-10-22 12:09 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).