Skip to contentSkip to conversation

neighbour: Disregard DEAD dst in neigh_update

PATCH In review Tong Zhu 3 participants 4 messages Dec 30, 2020 – Jan 8, 2021

Subsystems (3)
lore
Share & tools
lore

Tong Zhu

author
#0 lore raw

PATCH 1/1 neighbour: Disregard DEAD dst in neigh_update

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.

---
 net/core/neighbour.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/neighbour.c +1 -1
index 6e890f51b7d8..e471c32e448f 100644
@@ -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;
Signature · 1 line
2.17.1
maintainer
#1 lore raw

From: Tong Zhu <[email protected]>
Date: Wed, 30 Dec 2020 17:54:23 -0500

Quoted 4 lines

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.

Quoted 8 lines

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.

Please repost with an appropriate Fixes: tag.

Thanks.

#2 lore raw
Quoted 16 lines · David Miller

From: Tong Zhu <[email protected]>
Date: Wed, 30 Dec 2020 17:54:23 -0500

Quoted 11 lines

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.

Quoted 5 lines
Quoted 1 line

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

maintainer
#3 lore raw
Quoted 23 lines · Your Real Name
Quoted 16 lines · David Miller

From: Tong Zhu <[email protected]>
Date: Wed, 30 Dec 2020 17:54:23 -0500

Quoted 11 lines

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.

Quoted 5 lines
Quoted 1 line

Please repost with an appropriate Fixes: tag.

Thanks.

Quoted 7 lines

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