* [RESEND][PATCH] rocker: fix a neigh entry leak issue
@ 2015-05-15 4:53 Ying Xue
2015-05-15 5:23 ` Jiri Pirko
0 siblings, 1 reply; 2+ messages in thread
From: Ying Xue @ 2015-05-15 4:53 UTC (permalink / raw)
To: davem; +Cc: eric.dumazet, jiri, sfeldma, netdev
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>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
---
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 ec25153..cf98cc9 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -2921,10 +2921,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
@@ -2936,6 +2937,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] 2+ messages in thread
* Re: [RESEND][PATCH] rocker: fix a neigh entry leak issue
2015-05-15 4:53 [RESEND][PATCH] rocker: fix a neigh entry leak issue Ying Xue
@ 2015-05-15 5:23 ` Jiri Pirko
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Pirko @ 2015-05-15 5:23 UTC (permalink / raw)
To: Ying Xue; +Cc: davem, eric.dumazet, sfeldma, netdev
Fri, May 15, 2015 at 06:53:21AM CEST, ying.xue@windriver.com 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>
>Acked-by: Eric Dumazet <edumazet@google.com>
>Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-15 5:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15 4:53 [RESEND][PATCH] rocker: fix a neigh entry leak issue Ying Xue
2015-05-15 5:23 ` Jiri Pirko
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.