aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJay Vosburgh <fubar@us.ibm.com>2007-02-28 20:03:20 -0500
committerJeff Garzik <jeff@garzik.org>2007-03-06 06:08:11 -0500
commitc4f283b1f275e5528c13c119e5cfc80cdba55d00 (patch)
tree2d5b172fe18c84029619b3a5dca524a24f9c4e49 /drivers
parentc3442e296517aee733d62fc3fe03211598902c7d (diff)
bonding: fix double dev_add_pack
Bonding can erroneously register the same packet_type to receive ARPs (for use by ARP validation): once at device open time, and once via sysfs. Since sysfs can change the validate setting (and thus register or unregister) at any time, a flag is needed to synchronize with device open in order to avoid double registrations, and the simplest place is within the packet_type structure itself. Double unregister is not an issue. Bug reported by Ulrich Oelmann <ulrich.oelmann@web.de>. Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bonding/bond_main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ea73ebff4387..68afcb5d7257 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3423,6 +3423,9 @@ void bond_register_arp(struct bonding *bond)
3423{ 3423{
3424 struct packet_type *pt = &bond->arp_mon_pt; 3424 struct packet_type *pt = &bond->arp_mon_pt;
3425 3425
3426 if (pt->type)
3427 return;
3428
3426 pt->type = htons(ETH_P_ARP); 3429 pt->type = htons(ETH_P_ARP);
3427 pt->dev = NULL; /*bond->dev;XXX*/ 3430 pt->dev = NULL; /*bond->dev;XXX*/
3428 pt->func = bond_arp_rcv; 3431 pt->func = bond_arp_rcv;
@@ -3431,7 +3434,10 @@ void bond_register_arp(struct bonding *bond)
3431 3434
3432void bond_unregister_arp(struct bonding *bond) 3435void bond_unregister_arp(struct bonding *bond)
3433{ 3436{
3434 dev_remove_pack(&bond->arp_mon_pt); 3437 struct packet_type *pt = &bond->arp_mon_pt;
3438
3439 dev_remove_pack(pt);
3440 pt->type = 0;
3435} 3441}
3436 3442
3437/*---------------------------- Hashing Policies -----------------------------*/ 3443/*---------------------------- Hashing Policies -----------------------------*/