public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ding Tianhong <dingtianhong@huawei•com>
To: Veaceslav Falico <vfalico@gmail•com>, <netdev@vger•kernel.org>
Cc: Jay Vosburgh <j.vosburgh@gmail•com>,
	Andy Gospodarek <andy@greyhouse•net>
Subject: Re: [PATCH net-next 1/2] bonding: populate essential new_slave->bond/dev early
Date: Thu, 22 May 2014 10:23:15 +0800	[thread overview]
Message-ID: <537D5F93.4090308@huawei.com> (raw)
In-Reply-To: <1400686921-5698-2-git-send-email-vfalico@gmail.com>

On 2014/5/21 23:42, Veaceslav Falico wrote:
> The new bond_free_slave() needs new_slave->bond to verify if additional
> structures were allocated, so populate it early so that, in case of failure
> in bond_enslave(), we would be able to get it.
> 
> Also populate the new_slave->dev field, as it's too one of the most needed
> things to assign early.
> 
> CC: Jay Vosburgh <j.vosburgh@gmail•com>
> CC: Andy Gospodarek <andy@greyhouse•net>
> Signed-off-by: Veaceslav Falico <vfalico@gmail•com>
> ---
>  drivers/net/bonding/bond_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 7123205..923cdd5a 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1325,6 +1325,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>  		goto err_undo_flags;
>  	}
>  
> +	new_slave->bond = bond;
> +	new_slave->dev = slave_dev;
>  	/*
>  	 * Set the new_slave's queue_id to be zero.  Queue ID mapping
>  	 * is set via sysfs or module option if desired.
> @@ -1368,8 +1370,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>  		goto err_restore_mac;
>  	}
>  
> -	new_slave->bond = bond;
> -	new_slave->dev = slave_dev;
>  	slave_dev->priv_flags |= IFF_BONDING;
>  
>  	if (bond_is_lb(bond)) {
> 

Good catch.

Acked-by: Ding Tianhong <dingtianhong@huawei•com>

  reply	other threads:[~2014-05-22  2:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 15:41 [PATCH net-next 0/2] bonding: fix enslaving a dev without mtu setting support Veaceslav Falico
2014-05-21 15:42 ` [PATCH net-next 1/2] bonding: populate essential new_slave->bond/dev early Veaceslav Falico
2014-05-22  2:23   ` Ding Tianhong [this message]
2014-05-21 15:42 ` [PATCH net-next 2/2] bonding: remove NULL verification from bond_get_bond_by_slave() Veaceslav Falico
2014-05-22 19:47 ` [PATCH net-next 0/2] bonding: fix enslaving a dev without mtu setting support David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=537D5F93.4090308@huawei.com \
    --to=dingtianhong@huawei$(echo .)com \
    --cc=andy@greyhouse$(echo .)net \
    --cc=j.vosburgh@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=vfalico@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox