public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: 吉藤英明 <yoshfuji@linux-ipv6.org>,
	"David Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [BUG?] dst reference leak possible in ndisc_send
Date: Sat, 19 Jul 2008 23:33:24 -0700	[thread overview]
Message-ID: <20080719233324.49392616@extreme> (raw)
In-Reply-To: <20080719233140.601a15a4@extreme>

On Sat, 19 Jul 2008 23:31:40 -0700
Stephen Hemminger <shemminger@vyatta.com> wrote:

> This code path looks like it leaks the dst_entry  if xfrm_lookup fails:
> 
> static void __ndisc_send(struct net_device *dev,
> 			 struct neighbour *neigh,
> 			 const struct in6_addr *daddr,
> 			 const struct in6_addr *saddr,
> 			 struct icmp6hdr *icmp6h, const struct in6_addr *target,
> 			 int llinfo)
> {
> 	struct flowi fl;
> 	struct dst_entry *dst;
> 	struct net *net = dev_net(dev);
> 	struct sock *sk = net->ipv6.ndisc_sk;
> 	struct sk_buff *skb;
> 	struct icmp6hdr *hdr;
> 	struct inet6_dev *idev;
> 	int len;
> 	int err;
> 	u8 *opt, type;
> 
> 	type = icmp6h->icmp6_type;
> 
> 	icmpv6_flow_init(sk, &fl, type, saddr, daddr, dev->ifindex);
> 
> 	dst = icmp6_dst_alloc(dev, neigh, daddr);
> 	if (!dst)
> 		return;
> 
> 	err = xfrm_lookup(&dst, &fl, NULL, 0);
> 	if (err < 0)
> 		return;

Never mind xfrm_lookup frees dst on error

      reply	other threads:[~2008-07-20  6:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-20  6:31 [BUG?] dst reference leak possible in ndisc_send Stephen Hemminger
2008-07-20  6:33 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080719233324.49392616@extreme \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox