* [PATCH 1/3] bonding: fix double dev_add_pack
@ 2007-03-01 1:03 Jay Vosburgh
2007-03-06 11:10 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Jay Vosburgh @ 2007-03-01 1:03 UTC (permalink / raw)
To: netdev, bonding-devel; +Cc: Jeff Garzik
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>
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index a7c8f98..1f263ac 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 *b
{
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 *b
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 -----------------------------*/
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/3] bonding: fix double dev_add_pack
2007-03-01 1:03 [PATCH 1/3] bonding: fix double dev_add_pack Jay Vosburgh
@ 2007-03-06 11:10 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-03-06 11:10 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: netdev, bonding-devel
Jay Vosburgh wrote:
> 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>
applied 1-3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-06 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-01 1:03 [PATCH 1/3] bonding: fix double dev_add_pack Jay Vosburgh
2007-03-06 11:10 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).