aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_alb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_alb.c')
-rw-r--r--drivers/net/bonding/bond_alb.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 0f59c1564e53..e15cc11edbbe 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -342,27 +342,17 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
342 _unlock_rx_hashtbl_bh(bond); 342 _unlock_rx_hashtbl_bh(bond);
343} 343}
344 344
345static int rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, 345static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond,
346 struct slave *slave) 346 struct slave *slave)
347{ 347{
348 struct arp_pkt *arp; 348 struct arp_pkt *arp, _arp;
349 349
350 if (skb->protocol != cpu_to_be16(ETH_P_ARP)) 350 if (skb->protocol != cpu_to_be16(ETH_P_ARP))
351 goto out; 351 goto out;
352 352
353 arp = (struct arp_pkt *) skb->data; 353 arp = skb_header_pointer(skb, 0, sizeof(_arp), &_arp);
354 if (!arp) { 354 if (!arp)
355 pr_debug("Packet has no ARP data\n");
356 goto out; 355 goto out;
357 }
358
359 if (!pskb_may_pull(skb, arp_hdr_len(bond->dev)))
360 goto out;
361
362 if (skb->len < sizeof(struct arp_pkt)) {
363 pr_debug("Packet is too small to be an ARP\n");
364 goto out;
365 }
366 356
367 if (arp->op_code == htons(ARPOP_REPLY)) { 357 if (arp->op_code == htons(ARPOP_REPLY)) {
368 /* update rx hash table for this ARP */ 358 /* update rx hash table for this ARP */
@@ -1356,12 +1346,12 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1356 } 1346 }
1357 } 1347 }
1358 1348
1349 read_unlock(&bond->curr_slave_lock);
1350
1359 if (res) { 1351 if (res) {
1360 /* no suitable interface, frame not sent */ 1352 /* no suitable interface, frame not sent */
1361 dev_kfree_skb(skb); 1353 kfree_skb(skb);
1362 } 1354 }
1363 read_unlock(&bond->curr_slave_lock);
1364
1365 return NETDEV_TX_OK; 1355 return NETDEV_TX_OK;
1366} 1356}
1367 1357