* [PATCH net-next v2] rocker: fix a neigh entry leak issue
@ 2015-05-15 1:33 Ying Xue
2015-05-15 1:59 ` Eric Dumazet
2015-05-15 2:26 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Ying Xue @ 2015-05-15 1:33 UTC (permalink / raw)
To: netdev; +Cc: eric.dumazet, jiri, sfeldma, davem
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 as we don't put the refcount again after it's
used, this makes the neighbour entry leaked.
Suggested-by: Eric Dumazet <edumazet@google•com>
Acked-by: Jiri Pirko <jiri@resnulli•us>
Signed-off-by: Ying Xue <ying.xue@windriver•com>
---
v2:
Add the checking of return value of neigh_create() with IS_ERR()
to avoid another crash, which is suggested by Eric Dumazet.
drivers/net/ethernet/rocker/rocker.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index f0a9cb4..3e13dcc 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -3037,10 +3037,11 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port,
struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr);
int err = 0;
- if (!n)
+ if (!n) {
n = neigh_create(&arp_tbl, &ip_addr, dev);
- if (!n)
- return -ENOMEM;
+ if (IS_ERR(n))
+ return IS_ERR(n);
+ }
/* If the neigh is already resolved, then go ahead and
* install the entry, otherwise start the ARP process to
@@ -3053,6 +3054,7 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port,
else
neigh_event_send(n, NULL);
+ neigh_release(n);
return err;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next v2] rocker: fix a neigh entry leak issue
2015-05-15 1:33 [PATCH net-next v2] rocker: fix a neigh entry leak issue Ying Xue
@ 2015-05-15 1:59 ` Eric Dumazet
2015-05-15 2:26 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2015-05-15 1:59 UTC (permalink / raw)
To: Ying Xue; +Cc: netdev, jiri, sfeldma, davem
On Fri, 2015-05-15 at 09:33 +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 as we don't put the refcount again after it's
> used, this makes the neighbour entry leaked.
>
> Suggested-by: Eric Dumazet <edumazet@google•com>
> Acked-by: Jiri Pirko <jiri@resnulli•us>
> Signed-off-by: Ying Xue <ying.xue@windriver•com>
> ---
> v2:
Acked-by: Eric Dumazet <edumazet@google•com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] rocker: fix a neigh entry leak issue
2015-05-15 1:33 [PATCH net-next v2] rocker: fix a neigh entry leak issue Ying Xue
2015-05-15 1:59 ` Eric Dumazet
@ 2015-05-15 2:26 ` David Miller
2015-05-15 2:30 ` Ying Xue
1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2015-05-15 2:26 UTC (permalink / raw)
To: ying.xue; +Cc: netdev, eric.dumazet, jiri, sfeldma
From: Ying Xue <ying.xue@windriver•com>
Date: Fri, 15 May 2015 09:33:25 +0800
> 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 as we don't put the refcount again after it's
> used, this makes the neighbour entry leaked.
>
> Suggested-by: Eric Dumazet <edumazet@google•com>
> Acked-by: Jiri Pirko <jiri@resnulli•us>
> Signed-off-by: Ying Xue <ying.xue@windriver•com>
> ---
> v2:
> Add the checking of return value of neigh_create() with IS_ERR()
> to avoid another crash, which is suggested by Eric Dumazet.
Doesn't this leak exist in the 'net' tree?
If so, why are you targetting such a bug fix for 'net-next'?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] rocker: fix a neigh entry leak issue
2015-05-15 2:26 ` David Miller
@ 2015-05-15 2:30 ` Ying Xue
0 siblings, 0 replies; 4+ messages in thread
From: Ying Xue @ 2015-05-15 2:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev, eric.dumazet, jiri, sfeldma
On 05/15/2015 10:26 AM, David Miller wrote:
> From: Ying Xue <ying.xue@windriver•com>
> Date: Fri, 15 May 2015 09:33:25 +0800
>
>> 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 as we don't put the refcount again after it's
>> used, this makes the neighbour entry leaked.
>>
>> Suggested-by: Eric Dumazet <edumazet@google•com>
>> Acked-by: Jiri Pirko <jiri@resnulli•us>
>> Signed-off-by: Ying Xue <ying.xue@windriver•com>
>> ---
>> v2:
>> Add the checking of return value of neigh_create() with IS_ERR()
>> to avoid another crash, which is suggested by Eric Dumazet.
>
> Doesn't this leak exist in the 'net' tree?
>
> If so, why are you targetting such a bug fix for 'net-next'?
>
>
Sorry, I am used to develop in net-next tree. Please wait a moment, I will check
whether the issue also exists in net tree.
Regards,
Ying
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-15 2:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-15 1:33 [PATCH net-next v2] rocker: fix a neigh entry leak issue Ying Xue
2015-05-15 1:59 ` Eric Dumazet
2015-05-15 2:26 ` David Miller
2015-05-15 2:30 ` Ying Xue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox