aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-05-15 00:53:21 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-15 21:20:16 -0400
commit1f9993f6825f9cb93f75f794b66e7428dfc72467 (patch)
tree90e8005805a0d73bbb3c401899930dbeb39ed914
parent86b5e7de07aa1abc87ecc40d2aca6070348e4469 (diff)
rocker: fix a neigh entry leak issue
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/rocker/rocker.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index ec251531bd9f..cf98cc9bbc8d 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,
2921 struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr); 2921 struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr);
2922 int err = 0; 2922 int err = 0;
2923 2923
2924 if (!n) 2924 if (!n) {
2925 n = neigh_create(&arp_tbl, &ip_addr, dev); 2925 n = neigh_create(&arp_tbl, &ip_addr, dev);
2926 if (!n) 2926 if (IS_ERR(n))
2927 return -ENOMEM; 2927 return IS_ERR(n);
2928 }
2928 2929
2929 /* If the neigh is already resolved, then go ahead and 2930 /* If the neigh is already resolved, then go ahead and
2930 * install the entry, otherwise start the ARP process to 2931 * install the entry, otherwise start the ARP process to
@@ -2936,6 +2937,7 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port,
2936 else 2937 else
2937 neigh_event_send(n, NULL); 2938 neigh_event_send(n, NULL);
2938 2939
2940 neigh_release(n);
2939 return err; 2941 return err;
2940} 2942}
2941 2943