Skip to content

Commit

Permalink
ipv6: Fix 'inet6_rtm_getroute' to release 'rt->dst' in case of 'alloc…
Browse files Browse the repository at this point in the history
…_skb' failure

In 72331bc [ipv6: Fix RTM_GETROUTE's interpretation of RTA_IIF to be
consistent with ipv4] the code of 'inet6_rtm_getroute()' was re-ordered
such that the reference to 'rt->dst' is incremented prior skb
allocation.

Hence, if 'alloc_skb()' fails, must drop a reference from 'rt->dst'.
Add the missing 'dst_release()' call.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shmulik Ladkani authored and David S. Miller committed Apr 4, 2012
1 parent 7ebae81 commit 2173bff
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void

skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
if (!skb) {
dst_release(&rt->dst);
err = -ENOBUFS;
goto errout;
}
Expand Down

0 comments on commit 2173bff

Please sign in to comment.