Skip to content

Commit

Permalink
netfilter: Fix potential use after free in ip6_route_me_harder()
Browse files Browse the repository at this point in the history
Dst is released one line before we access it again with dst->error.

Fixes: 58e35d1 netfilter: ipv6: propagate routing errors from
ip6_route_me_harder()

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Sergey Popovich authored and ummakynes committed May 9, 2014
1 parent aff09ce commit a8951d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/ipv6/netfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ int ip6_route_me_harder(struct sk_buff *skb)
.daddr = iph->daddr,
.saddr = iph->saddr,
};
int err;

dst = ip6_route_output(net, skb->sk, &fl6);
if (dst->error) {
err = dst->error;
if (err) {
IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n");
dst_release(dst);
return dst->error;
return err;
}

/* Drop old route. */
Expand Down

0 comments on commit a8951d5

Please sign in to comment.