diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 9261388d5ac2..285743bfbed3 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c @@ -655,7 +655,7 @@ struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *orig, conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC); if (!conntrack) { DEBUGP("Can't allocate conntrack.\n"); - return NULL; + return ERR_PTR(-ENOMEM); } memset(conntrack, 0, sizeof(*conntrack)); @@ -696,8 +696,9 @@ init_conntrack(struct ip_conntrack_tuple *tuple, return NULL; } - if (!(conntrack = ip_conntrack_alloc(tuple, &repl_tuple))) - return NULL; + conntrack = ip_conntrack_alloc(tuple, &repl_tuple); + if (conntrack == NULL || IS_ERR(conntrack)) + return (struct ip_conntrack_tuple_hash *)conntrack; if (!protocol->new(conntrack, skb)) { ip_conntrack_free(conntrack);