From: Florian Westphal <fw@strlen.de>
To: fgao@ikuai8.com
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, netdev@vger.kernel.org,
gfree.wind@gmail.com
Subject: Re: [PATCH v2 1/2 nf] netfilter: seqadj: Fix one possible panic in seqadj when mem is exhausted
Date: Fri, 2 Sep 2016 08:59:14 +0200 [thread overview]
Message-ID: <20160902065914.GC8883@breakpoint.cc> (raw)
In-Reply-To: <1472792932-26187-1-git-send-email-fgao@ikuai8.com>
fgao@ikuai8.com <fgao@ikuai8.com> wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> When memory is exhausted, nfct_seqadj_ext_add may fail to add the seqadj
> extension. But the function nf_ct_seqadj_init doesn't check if get valid
> seqadj pointer by the nfct_seqadj, while other functions perform the
> sanity check.
>
> So the system would be panic when nfct_seqadj_ext_add failed.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> diff --git a/net/netfilter/nf_conntrack_seqadj.c b/net/netfilter/nf_conntrack_seqadj.c
> index dff0f0c..2c8e201 100644
> --- a/net/netfilter/nf_conntrack_seqadj.c
> +++ b/net/netfilter/nf_conntrack_seqadj.c
> @@ -16,9 +16,14 @@ int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
> if (off == 0)
> return 0;
>
> + seqadj = nfct_seqadj(ct);
> + if (unlikely(!seqadj)) {
> + WARN_ONCE(1, "Missing nfct_seqadj_ext_add() setup call\n");
> + return 0;
> + }
> +
Not sure this WARN() is really needed, I would remove it (since its most
likely only missing due to memory shortage).
Other than that, this looks good.
next prev parent reply other threads:[~2016-09-02 6:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 5:08 [PATCH v2 1/2 nf] netfilter: seqadj: Fix one possible panic in seqadj when mem is exhausted fgao
2016-09-02 6:59 ` Florian Westphal [this message]
2016-09-02 7:07 ` Gao Feng
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=20160902065914.GC8883@breakpoint.cc \
--to=fw@strlen.de \
--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