Skip to content

Commit

Permalink
bonding: correctly process non-linear skbs
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Andy Gospodarek <[email protected]>
CC: Alexander Duyck <[email protected]>
CC: Jesse Brandeburg <[email protected]>
CC: [email protected]
Signed-off-by: Jay Vosburgh <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
gospo authored and davem330 committed Sep 14, 2010
1 parent a89b476 commit ab12811
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/bonding/bond_3ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/bonding/bond_alb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ab12811

Please sign in to comment.