Skip to contentSkip to conversation

neighbor: Reset gc_entries counter if new entry is released before insert

PATCH In review David Ahern 5 participants 6 messages May 2, 2019 – Jun 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 neighbor: Reset gc_entries counter if new entry is released before insert

From: David Ahern <[email protected]>

Ian and Alan both reported seeing overflows after upgrades to 5.x kernels:
neighbour: arp_cache: neighbor table overflow!

Alan's mpls script helped get to the bottom of this bug. When a new entry is created the gc_entries counter is bumped in neigh_alloc to check if a new one is allowed to be created. ___neigh_create then searches for an existing entry before inserting the just allocated one. If an entry already exists, the new one is dropped in favor of the existing one. In this case the cleanup path needs to drop the gc_entries counter. There is no memory leak, only a counter leak.

Fixes 58956317c8d ("neighbor: Improve garbage collection")
---
 net/core/neighbour.c | 2 ++
 1 file changed, 2 insertions(+)
net/core/neighbour.c +2 -0
index 30f6fd8f68e0..aff051e5521d 100644
@@ -663,6 +663,8 @@ static struct neighbour *___neigh_create(struct neigh_table *tbl,
 out_tbl_unlock:
 	write_unlock_bh(&tbl->lock);
 out_neigh_release:
+	if (!exempt_from_gc)
+		atomic_dec(&tbl->gc_entries);
 	neigh_release(n);
 	goto out;
 }
Signature · 1 line
2.11.0
Tested-by on v1 1/1
#1 lore raw
Quoted 13 lines · David Ahern

From: David Ahern <[email protected]>

Ian and Alan both reported seeing overflows after upgrades to 5.x kernels:
neighbour: arp_cache: neighbor table overflow!

Alan's mpls script helped get to the bottom of this bug. When a new entry is created the gc_entries counter is bumped in neigh_alloc to check if a new one is allowed to be created. ___neigh_create then searches for an existing entry before inserting the just allocated one. If an entry already exists, the new one is dropped in favor of the existing one. In this case the cleanup path needs to drop the gc_entries counter. There is no memory leak, only a counter leak.

Quoted 4 lines
Fixes 58956317c8d ("neighbor: Improve garbage collection")
Quoted 21 lines
---
 net/core/neighbour.c | 2 ++
 1 file changed, 2 insertions(+)
net/core/neighbour.c +2 -0
index 30f6fd8f68e0..aff051e5521d 100644
@@ -663,6 +663,8 @@ static struct neighbour *___neigh_create(struct neigh_table *tbl,
 out_tbl_unlock:
 	write_unlock_bh(&tbl->lock);
 out_neigh_release:
+	if (!exempt_from_gc)
+		atomic_dec(&tbl->gc_entries);
 	neigh_release(n);
 	goto out;
 }
Signature · 1 line
2.11.0
maintainer
#2 lore raw
In reply to David Ahern

From: David Ahern <[email protected]>
Date: Wed, 1 May 2019 18:08:34 -0700

Quoted 13 lines

From: David Ahern <[email protected]>

Ian and Alan both reported seeing overflows after upgrades to 5.x kernels:
neighbour: arp_cache: neighbor table overflow!

Alan's mpls script helped get to the bottom of this bug. When a new entry is created the gc_entries counter is bumped in neigh_alloc to check if a new one is allowed to be created. ___neigh_create then searches for an existing entry before inserting the just allocated one. If an entry already exists, the new one is dropped in favor of the existing one. In this case the cleanup path needs to drop the gc_entries counter. There is no memory leak, only a counter leak.

Quoted 4 lines
Fixes 58956317c8d ("neighbor: Improve garbage collection")

Applied and queued up for -stable.

#3 lore raw

Hi,

Quoted 16 lines · David Miller

From: David Ahern <[email protected]>
Date: Wed, 1 May 2019 18:08:34 -0700

Quoted 13 lines

From: David Ahern <[email protected]>

Ian and Alan both reported seeing overflows after upgrades to 5.x kernels:
neighbour: arp_cache: neighbor table overflow!

Alan's mpls script helped get to the bottom of this bug. When a new entry is created the gc_entries counter is bumped in neigh_alloc to check if a new one is allowed to be created. ___neigh_create then searches for an existing entry before inserting the just allocated one. If an entry already exists, the new one is dropped in favor of the existing one. In this case the cleanup path needs to drop the gc_entries counter. There is no memory leak, only a counter leak.

Quoted 6 lines
Quoted 4 lines
Fixes 58956317c8d ("neighbor: Improve garbage collection")

Applied and queued up for -stable.

Did this get lost in the shuffle? I see it in mainline, but I don't see it in stable. Folks are encountering it with recent 5.1 kernels in
Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1708717.

Thanks,
Jeremy

maintainer
#5 lore raw
In reply to Jeremy Cline

From: Jeremy Cline <[email protected]>
Date: Thu, 6 Jun 2019 13:07:29 -0400

Quoted 24 lines

Hi,

Quoted 21 lines · David Miller

From: David Ahern <[email protected]>
Date: Wed, 1 May 2019 18:08:34 -0700

Quoted 17 lines

From: David Ahern <[email protected]>

Ian and Alan both reported seeing overflows after upgrades to 5.x kernels:
neighbour: arp_cache: neighbor table overflow!

Alan's mpls script helped get to the bottom of this bug. When a new entry is created the gc_entries counter is bumped in neigh_alloc to check if a new one is allowed to be created. ___neigh_create then searches for an existing entry before inserting the just allocated one. If an entry already exists, the new one is dropped in favor of the existing one. In this case the cleanup path needs to drop the gc_entries counter. There is no memory leak, only a counter leak.

Fixes 58956317c8d ("neighbor: Improve garbage collection")
Quoted 5 lines
Quoted 1 line

Applied and queued up for -stable.

Did this get lost in the shuffle? I see it in mainline, but I don't see it in stable. Folks are encountering it with recent 5.1 kernels in
Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1708717.

It's there in the -stable queue:

https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive=

So it will (eventually) get sent.