From: ebiederm@xmission.com (Eric W. Biederman)
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] ipv6: move dereference after check in fl_free()
Date: Thu, 16 Aug 2012 16:11:36 -0700 [thread overview]
Message-ID: <87sjbm1lg7.fsf@xmission.com> (raw)
In-Reply-To: <20120816131502.GB23188@elgon.mountain> (Dan Carpenter's message of "Thu, 16 Aug 2012 16:15:02 +0300")
Dan Carpenter <dan.carpenter@oracle.com> writes:
> There is a dereference before checking for NULL bug here. Generally
> free() functions should accept NULL pointers. For example, fl_create()
> can pass a NULL pointer to fl_free() on the error path.
Thanks.
Applied to user-namespace.git
Eric
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Only needed on linux-next.
>
> diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
> index c836a6a..90bbefb 100644
> --- a/net/ipv6/ip6_flowlabel.c
> +++ b/net/ipv6/ip6_flowlabel.c
> @@ -91,12 +91,9 @@ static struct ip6_flowlabel *fl_lookup(struct net *net, __be32 label)
>
> static void fl_free(struct ip6_flowlabel *fl)
> {
> - switch (fl->share) {
> - case IPV6_FL_S_PROCESS:
> - put_pid(fl->owner.pid);
> - break;
> - }
> if (fl) {
> + if (fl->share == IPV6_FL_S_PROCESS)
> + put_pid(fl->owner.pid);
> release_net(fl->fl_net);
> kfree(fl->opt);
> }
prev parent reply other threads:[~2012-08-16 23:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 13:15 [patch] ipv6: move dereference after check in fl_free() Dan Carpenter
2012-08-16 23:11 ` Eric W. Biederman [this message]
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=87sjbm1lg7.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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