netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liping Zhang <zlpnobody@gmail.com>
To: fgao@ikuai8.com
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, Feng Gao <gfree.wind@gmail.com>
Subject: Re: [PATCH 1/2 nf] netfilter: seqadj: Fix some possible panics of seqadj when mem is exhausted
Date: Fri, 2 Sep 2016 12:50:48 +0800	[thread overview]
Message-ID: <CAML_gOe+Ao5WEuVbTry_oekwsm2-ooZ074pgfpzxYzNehgLGjQ@mail.gmail.com> (raw)
In-Reply-To: <1472780905-13094-1-git-send-email-fgao@ikuai8.com>

Hi Feng,
2016-09-02 9:48 GMT+08:00  <fgao@ikuai8.com>:
> From: Gao Feng <fgao@ikuai8.com>
> @@ -171,6 +176,11 @@ int nf_ct_seq_adjust(struct sk_buff *skb,
>         struct nf_ct_seqadj *this_way, *other_way;
>         int res;
>
> +       if (unlikely(!seqadj)) {

IPS_SEQ_ADJUST_BIT will be tested before we call nf_ct_seq_adjust(),
so I think seqadj
will never be NULL here.

> +               WARN_ONCE(1, "Missing nfct_seqadj_ext_add() setup call\n");
> +               return 0;
> +       }
> +
>         this_way  = &seqadj->seq[dir];
>         other_way = &seqadj->seq[!dir];
>
> @@ -218,8 +228,10 @@ s32 nf_ct_seq_offset(const struct nf_conn *ct,
>         struct nf_conn_seqadj *seqadj = nfct_seqadj(ct);
>         struct nf_ct_seqadj *this_way;
>
> -       if (!seqadj)
> +       if (unlikely(!seqadj)) {
> +               WARN_ONCE(1, "Missing nfct_seqadj_ext_add() setup call\n");

But in nf_ct_seq_offset, seqadj is likely to be NULL, see the function
call path:
tcp_packet->tcp_in_window->nf_ct_seq_offset, so WARN_ONCE seems unnecessary.

>                 return 0;
> +       }

  reply	other threads:[~2016-09-02  4:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  1:48 [PATCH 1/2 nf] netfilter: seqadj: Fix some possible panics of seqadj when mem is exhausted fgao
2016-09-02  4:50 ` Liping Zhang [this message]
2016-09-02  4:57   ` Gao Feng
2016-09-16 14:04 ` [lkp] [netfilter] 68263ddb47: WARNING: CPU: 0 PID: 1225 at net/netfilter/nf_conntrack_seqadj.c:232 nf_ct_seq_offset+0x7a/0x9a kernel test robot
     [not found]   ` <CA+6hz4o_Jub=zUcnXjy=oXS_5uZkxxw2Jv7p2FvdMqHV0pg+hw@mail.gmail.com>
2016-09-16 17:18     ` [netfilter-core] " Florian Westphal
     [not found]       ` <CA+6hz4rLzt+u8P+4rOrc3brp4kNK6DrCk546G-jGvcVPVcDmrg@mail.gmail.com>
2016-09-17 10:40         ` Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAML_gOe+Ao5WEuVbTry_oekwsm2-ooZ074pgfpzxYzNehgLGjQ@mail.gmail.com \
    --to=zlpnobody@gmail.com \
    --cc=coreteam@netfilter.org \
    --cc=fgao@ikuai8.com \
    --cc=gfree.wind@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).