All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipv6: Fix 'inet6_rtm_getroute' to release 'rt->dst' in case of 'alloc_skb' failure
@ 2012-04-04  9:13 Shmulik Ladkani
  2012-04-04  9:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Shmulik Ladkani @ 2012-04-04  9:13 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, linux-kernel, Eric Dumazet, Alexey Kuznetsov,
	James Morris, Hideaki YOSHIFUJI, Patrick McHardy

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>
---
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1178345..00b987c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2581,6 +2581,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;
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipv6: Fix 'inet6_rtm_getroute' to release 'rt->dst' in case of 'alloc_skb' failure
  2012-04-04  9:13 [PATCH] ipv6: Fix 'inet6_rtm_getroute' to release 'rt->dst' in case of 'alloc_skb' failure Shmulik Ladkani
@ 2012-04-04  9:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-04-04  9:26 UTC (permalink / raw)
  To: shmulik.ladkani
  Cc: netdev, linux-kernel, eric.dumazet, kuznet, jmorris, yoshfuji, kaber

From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Date: Wed, 4 Apr 2012 12:13:00 +0300

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-04  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  9:13 [PATCH] ipv6: Fix 'inet6_rtm_getroute' to release 'rt->dst' in case of 'alloc_skb' failure Shmulik Ladkani
2012-04-04  9:26 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.