Skip to content

Commit

Permalink
netfilter: nf_conntrack: checking for IS_ERR() instead of NULL
Browse files Browse the repository at this point in the history
We recently changed this from nf_conntrack_alloc() to nf_ct_tmpl_alloc()
so the error handling needs to changed to check for NULL instead of
IS_ERR().

Fixes: 0838aa7 ('netfilter: fix netns dependencies with conntrack templates')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Dan Carpenter authored and Pablo Neira Ayuso committed Jul 30, 2015
1 parent f0ad462 commit 1a727c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions net/netfilter/nf_synproxy_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,8 @@ static int __net_init synproxy_net_init(struct net *net)
int err = -ENOMEM;

ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL);
if (IS_ERR(ct)) {
err = PTR_ERR(ct);
if (!ct)
goto err1;
}

if (!nfct_seqadj_ext_add(ct))
goto err2;
Expand Down
5 changes: 3 additions & 2 deletions net/netfilter/xt_CT.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,10 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
goto err1;

ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL);
ret = PTR_ERR(ct);
if (IS_ERR(ct))
if (!ct) {
ret = -ENOMEM;
goto err2;
}

ret = 0;
if ((info->ct_events || info->exp_events) &&
Expand Down

0 comments on commit 1a727c6

Please sign in to comment.