diff options
author | Jay Vosburgh <fubar@us.ibm.com> | 2007-03-01 02:03:20 +0100 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-03-06 12:08:11 +0100 |
commit | c4f283b1f275e5528c13c119e5cfc80cdba55d00 (patch) | |
tree | 2d5b172fe18c84029619b3a5dca524a24f9c4e49 /drivers/net/bonding | |
parent | [PATCH] paravirt: re-enable COMPAT_VDSO (diff) | |
download | linux-c4f283b1f275e5528c13c119e5cfc80cdba55d00.tar.xz linux-c4f283b1f275e5528c13c119e5cfc80cdba55d00.zip |
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/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 8 |
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) { struct packet_type *pt = &bond->arp_mon_pt; + if (pt->type) + return; + pt->type = htons(ETH_P_ARP); pt->dev = NULL; /*bond->dev;XXX*/ pt->func = bond_arp_rcv; @@ -3431,7 +3434,10 @@ void bond_register_arp(struct bonding *bond) void bond_unregister_arp(struct bonding *bond) { - dev_remove_pack(&bond->arp_mon_pt); + struct packet_type *pt = &bond->arp_mon_pt; + + dev_remove_pack(pt); + pt->type = 0; } /*---------------------------- Hashing Policies -----------------------------*/ |