netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: ying.xue@windriver.com, jiri@resnulli.us, sfeldma@gmail.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next] rocker: fix a neigh entry leak issue
Date: Thu, 14 May 2015 12:17:51 -0400 (EDT)	[thread overview]
Message-ID: <20150514.121751.1894390478989103661.davem@davemloft.net> (raw)
In-Reply-To: <1431612382.27831.52.camel@edumazet-glaptop2.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 14 May 2015 07:06:22 -0700

> On Thu, 2015-05-14 at 15:06 +0800, Ying Xue wrote:
>> Once we get a neighbour through looking up arp cache or creating a
>> new one in rocker_port_ipv4_resolve(), the neighbour's refcount is
>> already taken. But we don't put the refcount again after it's used,
>> which make the neighbour entry leaked.
>> 
>> Signed-off-by: Ying Xue <ying.xue@windriver.com>
>> ---
>>  drivers/net/ethernet/rocker/rocker.c |    1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
>> index 1fc006b..7504540 100644
>> --- a/drivers/net/ethernet/rocker/rocker.c
>> +++ b/drivers/net/ethernet/rocker/rocker.c
>> @@ -3053,6 +3053,7 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port,
>>  	else
>>  		neigh_event_send(n, NULL);
>>  
>> +	neigh_release(n);
>>  	return err;
>>  }
>>  
> 
> I do not think this fix is complete.
> 
> neigh_create() can return an error, and we'll crash.

Correct, neigh_create() return values must be checked with IS_ERR().

      reply	other threads:[~2015-05-14 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14  7:06 [PATCH net-next] rocker: fix a neigh entry leak issue Ying Xue
2015-05-14  8:44 ` Jiri Pirko
2015-05-14 14:06 ` Eric Dumazet
2015-05-14 16:17   ` David Miller [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=20150514.121751.1894390478989103661.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@gmail.com \
    --cc=ying.xue@windriver.com \
    /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;
as well as URLs for NNTP newsgroup(s).