* [patch] ipv6: move dereference after check in fl_free()
@ 2012-08-16 13:15 Dan Carpenter
2012-08-16 23:11 ` Eric W. Biederman
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-08-16 13:15 UTC (permalink / raw)
To: Eric W. Biederman
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, kernel-janitors
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.
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);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] ipv6: move dereference after check in fl_free()
2012-08-16 13:15 [patch] ipv6: move dereference after check in fl_free() Dan Carpenter
@ 2012-08-16 23:11 ` Eric W. Biederman
0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2012-08-16 23:11 UTC (permalink / raw)
To: Dan Carpenter
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, kernel-janitors
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);
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-16 23:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox