Skip to content

Commit

Permalink
ipv6: move dereference after check in fl_free()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
  • Loading branch information
Dan Carpenter authored and Eric W. Biederman committed Aug 16, 2012
1 parent 0625c88 commit 898132a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/ipv6/ip6_flowlabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 898132a

Please sign in to comment.