Skip to content

Commit 1f9993f

Browse files
ying-xuedavem330
authored andcommitted
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 <[email protected]> Acked-by: Jiri Pirko <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: Ying Xue <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 86b5e7d commit 1f9993f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ethernet/rocker/rocker.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,10 +2921,11 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port,
29212921
struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr);
29222922
int err = 0;
29232923

2924-
if (!n)
2924+
if (!n) {
29252925
n = neigh_create(&arp_tbl, &ip_addr, dev);
2926-
if (!n)
2927-
return -ENOMEM;
2926+
if (IS_ERR(n))
2927+
return IS_ERR(n);
2928+
}
29282929

29292930
/* If the neigh is already resolved, then go ahead and
29302931
* install the entry, otherwise start the ARP process to
@@ -2936,6 +2937,7 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port,
29362937
else
29372938
neigh_event_send(n, NULL);
29382939

2940+
neigh_release(n);
29392941
return err;
29402942
}
29412943

0 commit comments

Comments
 (0)