lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20101221024608.GA5944@redhat.com>
Date:	Tue, 21 Dec 2010 00:46:08 -0200
From:	Flavio Leitner <fleitner@...hat.com>
To:	Ben Hutchings <bhutchings@...arflare.com>
Cc:	David Miller <davem@...emloft.net>,
	Jay Vosburgh <fubar@...ibm.com>, netdev@...r.kernel.org,
	linux-net-drivers@...arflare.com
Subject: Re: [PATCH net-2.6 2/3] bonding: Change active slave quietly when
 bond is down

On Mon, Dec 13, 2010 at 06:19:56PM +0000, Ben Hutchings wrote:
> bond_change_active_slave() may be called when a slave is added, even
> if the bond has not been brought up yet.  It may then attempt to send
> packets, and further it may use mcast_work which is uninitialised
> before the bond is brought up.  Add the necessary checks for
> netif_running(bond->dev).
> 
> Signed-off-by: Ben Hutchings <bhutchings@...arflare.com>
> ---
>  drivers/net/bonding/bond_main.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index ef370c9..3b16c34 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1178,11 +1178,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
>  				bond_do_fail_over_mac(bond, new_active,
>  						      old_active);
>  
> -			bond->send_grat_arp = bond->params.num_grat_arp;
> -			bond_send_gratuitous_arp(bond);
> +			if (netif_running(bond->dev)) {
> +				bond->send_grat_arp = bond->params.num_grat_arp;
> +				bond_send_gratuitous_arp(bond);
>  
> -			bond->send_unsol_na = bond->params.num_unsol_na;
> -			bond_send_unsolicited_na(bond);
> +				bond->send_unsol_na = bond->params.num_unsol_na;
> +				bond_send_unsolicited_na(bond);
> +			}
>  
>  			write_unlock_bh(&bond->curr_slave_lock);
>  			read_unlock(&bond->lock);
> @@ -1196,8 +1198,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
>  
>  	/* resend IGMP joins since active slave has changed or
>  	 * all were sent on curr_active_slave */
> -	if ((USES_PRIMARY(bond->params.mode) && new_active) ||
> -	    bond->params.mode == BOND_MODE_ROUNDROBIN) {
> +	if (((USES_PRIMARY(bond->params.mode) && new_active) ||
> +	     bond->params.mode == BOND_MODE_ROUNDROBIN) &&
> +	    netif_running(bond->dev)) {
>  		bond->igmp_retrans = bond->params.resend_igmp;
>  		queue_delayed_work(bond->wq, &bond->mcast_work, 0);
>  	}
> -- 
> 1.7.3.2

I had a script randomly adding/removing slaves and setting
the bonding device up and down to test that commit, so
I'm surprised that it didn't catch this combination before.

Acked-by: Flavio Leitner <fleitner@...hat.com>

Thanks,
-- 
Flavio
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ