netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] neighbour: Disregard DEAD dst in neigh_update
@ 2020-12-30 22:54 Tong Zhu
  2021-01-06  0:05 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Tong Zhu @ 2020-12-30 22:54 UTC (permalink / raw)
  To: davem, sashal, edumazet, zhutong, vvs; +Cc: netdev, stable, linux-kernel

In 4.x kernel a dst in DST_OBSOLETE_DEAD state is associated
with loopback net_device and leads to loopback neighbour. It
leads to an ethernet header with all zero addresses.

A very troubling case is working with mac80211 and ath9k.
A packet with all zero source MAC address to mac80211 will
eventually fail ieee80211_find_sta_by_ifaddr in ath9k (xmit.c).
As result, ath9k flushes tx queue (ath_tx_complete_aggr) without
updating baw (block ack window), damages baw logic and disables
transmission.

Signed-off-by: Tong Zhu <zhutong@amazon.com>
---
 net/core/neighbour.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 6e890f51b7d8..e471c32e448f 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1271,7 +1271,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
 			 * we can reinject the packet there.
 			 */
 			n2 = NULL;
-			if (dst) {
+			if (dst && dst->obsolete != DST_OBSOLETE_DEAD) {
 				n2 = dst_neigh_lookup_skb(dst, skb);
 				if (n2)
 					n1 = n2;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] neighbour: Disregard DEAD dst in neigh_update
  2020-12-30 22:54 [PATCH] neighbour: Disregard DEAD dst in neigh_update Tong Zhu
@ 2021-01-06  0:05 ` David Miller
  2021-01-08  2:36   ` Your Real Name
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2021-01-06  0:05 UTC (permalink / raw)
  To: zhutong; +Cc: sashal, edumazet, vvs, netdev, stable, linux-kernel

From: Tong Zhu <zhutong@amazon.com>
Date: Wed, 30 Dec 2020 17:54:23 -0500

> In 4.x kernel a dst in DST_OBSOLETE_DEAD state is associated
> with loopback net_device and leads to loopback neighbour. It
> leads to an ethernet header with all zero addresses.
> 
> A very troubling case is working with mac80211 and ath9k.
> A packet with all zero source MAC address to mac80211 will
> eventually fail ieee80211_find_sta_by_ifaddr in ath9k (xmit.c).
> As result, ath9k flushes tx queue (ath_tx_complete_aggr) without
> updating baw (block ack window), damages baw logic and disables
> transmission.
> 
> Signed-off-by: Tong Zhu <zhutong@amazon.com>

Please repost with an appropriate Fixes: tag.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] neighbour: Disregard DEAD dst in neigh_update
  2021-01-06  0:05 ` David Miller
@ 2021-01-08  2:36   ` Your Real Name
  2021-01-08  7:34     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Your Real Name @ 2021-01-08  2:36 UTC (permalink / raw)
  To: David Miller; +Cc: sashal, edumazet, vvs, netdev, stable, linux-kernel

On Tue, Jan 05, 2021 at 04:05:21PM -0800, David Miller wrote: 
> 
> 
> From: Tong Zhu <zhutong@amazon.com>
> Date: Wed, 30 Dec 2020 17:54:23 -0500
> 
> > In 4.x kernel a dst in DST_OBSOLETE_DEAD state is associated
> > with loopback net_device and leads to loopback neighbour. It
> > leads to an ethernet header with all zero addresses.
> >
> > A very troubling case is working with mac80211 and ath9k.
> > A packet with all zero source MAC address to mac80211 will
> > eventually fail ieee80211_find_sta_by_ifaddr in ath9k (xmit.c).
> > As result, ath9k flushes tx queue (ath_tx_complete_aggr) without
> > updating baw (block ack window), damages baw logic and disables
> > transmission.
> >
> > Signed-off-by: Tong Zhu <zhutong@amazon.com>
> 
> Please repost with an appropriate Fixes: tag.
> 
> Thanks.

I had a second thought on this. This fix should go mainline too. This is a 
case we are sending out queued packets when arp reply from the neighbour 
comes in. With 5.x kernel, a dst in DST_OBSOLETE_DEAD state leads to dropping
of this packet. It is not as bad as with 4.x kernel that may end up with an
all-zero mac address packet out to ethernet or choking up ath9k when using 
block ack. Dropping the packet is still wrong. I’ll repost as a fix to
mainline and target backport to 4.x LTS releases.

Best regards
    

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] neighbour: Disregard DEAD dst in neigh_update
  2021-01-08  2:36   ` Your Real Name
@ 2021-01-08  7:34     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2021-01-08  7:34 UTC (permalink / raw)
  To: Your Real Name
  Cc: David Miller, sashal, edumazet, vvs, netdev, stable, linux-kernel

On Thu, Jan 07, 2021 at 09:36:37PM -0500, Your Real Name wrote:
> On Tue, Jan 05, 2021 at 04:05:21PM -0800, David Miller wrote: 
> > 
> > 
> > From: Tong Zhu <zhutong@amazon.com>
> > Date: Wed, 30 Dec 2020 17:54:23 -0500
> > 
> > > In 4.x kernel a dst in DST_OBSOLETE_DEAD state is associated
> > > with loopback net_device and leads to loopback neighbour. It
> > > leads to an ethernet header with all zero addresses.
> > >
> > > A very troubling case is working with mac80211 and ath9k.
> > > A packet with all zero source MAC address to mac80211 will
> > > eventually fail ieee80211_find_sta_by_ifaddr in ath9k (xmit.c).
> > > As result, ath9k flushes tx queue (ath_tx_complete_aggr) without
> > > updating baw (block ack window), damages baw logic and disables
> > > transmission.
> > >
> > > Signed-off-by: Tong Zhu <zhutong@amazon.com>
> > 
> > Please repost with an appropriate Fixes: tag.
> > 
> > Thanks.
> 
> I had a second thought on this. This fix should go mainline too. This is a 
> case we are sending out queued packets when arp reply from the neighbour 
> comes in. With 5.x kernel, a dst in DST_OBSOLETE_DEAD state leads to dropping
> of this packet. It is not as bad as with 4.x kernel that may end up with an
> all-zero mac address packet out to ethernet or choking up ath9k when using 
> block ack. Dropping the packet is still wrong. I’ll repost as a fix to
> mainline and target backport to 4.x LTS releases.

That's how kernel development works, please read
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how stable kernels are allowed to accept patches.

good luck!

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] neighbour: Disregard DEAD dst in neigh_update
@ 2021-03-19 18:33 Tong Zhu
  0 siblings, 0 replies; 5+ messages in thread
From: Tong Zhu @ 2021-03-19 18:33 UTC (permalink / raw)
  To: davem, kuba, kvalo, johannes, netdev, linux-kernel; +Cc: zhutong

After a short network outage, the dst_entry is timed out and put
in DST_OBSOLETE_DEAD. We are in this code because arp reply comes
from this neighbour after network recovers. There is a potential
race condition that dst_entry is still in DST_OBSOLETE_DEAD.
With that, another neighbour lookup causes more harm than good.

In best case all packets in arp_queue are lost. This is
counterproductive to the original goal of finding a better path
for those packets.

I observed a worst case with 4.x kernel where a dst_entry in
DST_OBSOLETE_DEAD state is associated with loopback net_device.
It leads to an ethernet header with all zero addresses.
A packet with all zero source MAC address is quite deadly with
mac80211, ath9k and 802.11 block ack.  It fails
ieee80211_find_sta_by_ifaddr in ath9k (xmit.c). Ath9k flushes tx
queue (ath_tx_complete_aggr). BAW (block ack window) is not
updated. BAW logic is damaged and ath9k transmission is disabled.

Signed-off-by: Tong Zhu <zhutong@amazon.com>
---
 net/core/neighbour.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index e2982b3970b8..8379719d1dce 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1379,7 +1379,7 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr,
 			 * we can reinject the packet there.
 			 */
 			n2 = NULL;
-			if (dst) {
+			if (dst && dst->obsolete != DST_OBSOLETE_DEAD) {
 				n2 = dst_neigh_lookup_skb(dst, skb);
 				if (n2)
 					n1 = n2;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-19 18:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 22:54 [PATCH] neighbour: Disregard DEAD dst in neigh_update Tong Zhu
2021-01-06  0:05 ` David Miller
2021-01-08  2:36   ` Your Real Name
2021-01-08  7:34     ` Greg KH
2021-03-19 18:33 Tong Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).