Skip to contentSkip to conversation

bonding: correctly process LACPDUs in non-linear skbs

PATCH Applied Andy Gospodarek 3 participants 5 messages Sep 10, 2010 – Sep 14, 2010

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

PATCH 1/1 bonding: correctly process LACPDUs in non-linear skbs

It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it wasn't stored there. That explained the inability to form an 802.3ad-based bond.

This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.

Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.

CC Alexander Duyck <[email protected]>
CC Jesse Brandeburg <[email protected]>
---
 drivers/net/bonding/bond_3ad.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/bonding/bond_3ad.c +3 -0
index 822f586..0ddf4c6 100644
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
 	if (!(dev->flags & IFF_MASTER))
 		goto out;
 
+	if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
+		goto out;
+
 	read_lock(&bond->lock);
 	slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev),
 					orig_dev);
Signature · 1 line
1.7.0.1
#1 lore raw
Quoted 11 lines · Andy Gospodarek

It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it wasn't stored there. That explained the inability to form an 802.3ad-based bond.

This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.

Quoted 7 lines

Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.

CC Alexander Duyck <[email protected]>
CC Jesse Brandeburg <[email protected]>

Did you by any chance also test balance-alb mode? Inspection
suggests that rlb_arp_recv may suffer from the same problem.

If you agree, could you add that to the patch and resubmit it?

Either way, the patch looks good.

-J

Quoted 25 lines

---
drivers/net/bonding/bond_3ad.c | 3 +++

1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/bonding/bond_3ad.c +3 -0
index 822f586..0ddf4c6 100644
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
 	if (!(dev->flags & IFF_MASTER))
 		goto out;
 
+	if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
+		goto out;
+
 	read_lock(&bond->lock);
 	slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev),
 					orig_dev);
Signature · 6 lines
1.7.0.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH net-2.6 v2] bonding: correctly process non-linear skbs

Quoted 21 lines · Jay Vosburgh
Quoted 11 lines · Andy Gospodarek

It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it wasn't stored there. That explained the inability to form an 802.3ad-based bond.

This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.

Quoted 7 lines

Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.

CC Alexander Duyck <[email protected]>
CC Jesse Brandeburg <[email protected]>
Quoted 7 lines

Did you by any chance also test balance-alb mode? Inspection
suggests that rlb_arp_recv may suffer from the same problem.

If you agree, could you add that to the patch and resubmit it?

Either way, the patch looks good.

You are correct, Jay. I did a quick test and confirmed that ARPs might not be properly processed when using balance-ALB too. Below is a patch to fix both spots:

[PATCH net-2.6 v2] bonding: correctly process non-linear skbs

It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it was not stored there. That explained the inability to form an 802.3ad-based bond. For balance-alb mode bonds this was also an issue as ARPs would not be properly processed.

This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.

Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.

CC Alexander Duyck <[email protected]>
CC Jesse Brandeburg <[email protected]>
---
 drivers/net/bonding/bond_3ad.c |    3 +++
 drivers/net/bonding/bond_alb.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/bonding/bond_3ad.c +3 -0
index 822f586..0ddf4c6 100644
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
 	if (!(dev->flags & IFF_MASTER))
 		goto out;
 
+	if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
+		goto out;
+
 	read_lock(&bond->lock);
 	slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev),
 					orig_dev);
drivers/net/bonding/bond_alb.c +3 -0
index c746b33..26bb118 100644
@@ -362,6 +362,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
 		goto out;
 	}
 
+	if (!pskb_may_pull(skb, arp_hdr_len(bond_dev)))
+		goto out;
+
 	if (skb->len < sizeof(struct arp_pkt)) {
 		pr_debug("Packet is too small to be an ARP\n");
 		goto out;
Signature · 1 line
1.7.0.1
#3 lore raw

Re: [PATCH net-2.6 v2] bonding: correctly process non-linear skbs

Quoted 48 lines · Andy Gospodarek
Quoted 21 lines · Jay Vosburgh
Quoted 11 lines · Andy Gospodarek

It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it wasn't stored there. That explained the inability to form an 802.3ad-based bond.

This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.

Quoted 7 lines

Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.

CC Alexander Duyck <[email protected]>
CC Jesse Brandeburg <[email protected]>
Quoted 7 lines

Did you by any chance also test balance-alb mode? Inspection
suggests that rlb_arp_recv may suffer from the same problem.

If you agree, could you add that to the patch and resubmit it?

Either way, the patch looks good.

You are correct, Jay. I did a quick test and confirmed that ARPs might not be properly processed when using balance-ALB too. Below is a patch to fix both spots:

[PATCH net-2.6 v2] bonding: correctly process non-linear skbs

It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it was not stored there. That explained the inability to form an 802.3ad-based bond. For balance-alb mode bonds this was also an issue as ARPs would not be properly processed.

This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.

Quoted 7 lines

Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.

CC Alexander Duyck <[email protected]>
CC Jesse Brandeburg <[email protected]>
Quoted 37 lines

---

drivers/net/bonding/bond_3ad.c |    3 +++
drivers/net/bonding/bond_alb.c |    3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/bonding/bond_3ad.c +3 -0
index 822f586..0ddf4c6 100644
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
 	if (!(dev->flags & IFF_MASTER))
 		goto out;
 
+	if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
+		goto out;
+
 	read_lock(&bond->lock);
 	slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev),
 					orig_dev);
drivers/net/bonding/bond_alb.c +3 -0
index c746b33..26bb118 100644
@@ -362,6 +362,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
 		goto out;
 	}
 
+	if (!pskb_may_pull(skb, arp_hdr_len(bond_dev)))
+		goto out;
+
 	if (skb->len < sizeof(struct arp_pkt)) {
 		pr_debug("Packet is too small to be an ARP\n");
 		goto out;
Signature · 2 lines
-- 
1.7.0.1
maintainer Applied
#4 lore raw

Re: [PATCH net-2.6 v2] bonding: correctly process non-linear skbs

From: Jay Vosburgh <[email protected]>
Date: Fri, 10 Sep 2010 18:08:35 -0700

Quoted 17 lines
Quoted 16 lines · Andy Gospodarek

[PATCH net-2.6 v2] bonding: correctly process non-linear skbs

It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it was not stored there. That explained the inability to form an 802.3ad-based bond. For balance-alb mode bonds this was also an issue as ARPs would not be properly processed.

This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.

Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.

Quoted 7 lines
Quoted 4 lines
CC Alexander Duyck <[email protected]>
CC Jesse Brandeburg <[email protected]>

Applied, thanks everyone.