From patchwork Tue Feb 26 08:26:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 223144 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 694ED2C007C for ; Tue, 26 Feb 2013 19:26:26 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758444Ab3BZI0W (ORCPT ); Tue, 26 Feb 2013 03:26:22 -0500 Received: from mail-wg0-f43.google.com ([74.125.82.43]:47901 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752911Ab3BZI0V (ORCPT ); Tue, 26 Feb 2013 03:26:21 -0500 Received: by mail-wg0-f43.google.com with SMTP id e12so3205867wge.10 for ; Tue, 26 Feb 2013 00:26:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=nWFLlBF1AXzPPZhZPzigoA66RvajSp7PbnnSkP2cEeA=; b=UKx4GOm6o120HB3QqU/lvlXZ9lHCYoC2Io42RnedOcuZWMrxc1Z77r7KIP6Zw8QpzM Ws8yc2XHtuBEN8omz+QCUQ7aq6Nt3ADWqTuykW+PMk5qcvfNNUtKNRd8Ryfboa+oKm17 SHvWiHXnNkQzcMv0wEVuzC0FtmBOATLNC83HxiGGsjemHNiEfMBUFgH88LhEu4yqJqVE 3eFA4KtvTggIeogfXuY9GGGXncSgrCxS0oeQKi4WJBgwYndD5SshkEJOK07bTwXtJzc8 yTq1BgHhL/+9FBM/S623Ul0xoH2JdzjQO5Rf6cIblFHRvt4cPAjAyrPmunL1rqqXBs1l pvKQ== X-Received: by 10.180.75.143 with SMTP id c15mr12909913wiw.18.1361867180179; Tue, 26 Feb 2013 00:26:20 -0800 (PST) Received: from localhost (nat-pool-brq-t.redhat.com. [209.132.186.34]) by mx.google.com with ESMTPS id q13sm24536930wie.0.2013.02.26.00.26.17 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 26 Feb 2013 00:26:18 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, fubar@us.ibm.com, andy@greyhouse.net, gregory.v.rose@intel.com Subject: [patch net] bond: check if slave count is 0 in case when deciding to take slave's mac Date: Tue, 26 Feb 2013 09:26:15 +0100 Message-Id: <1361867175-4033-1-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.8.1.2 X-Gm-Message-State: ALoCoQnGDeBaC+ob8p/VTumCwij/pk/39xXDqIS+25cx2mkW/2JcvToHYXMt8psYL5OXU6IG+Mhp Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org in bond_enslave(), check slave_cnt before actually using slave address. introduced by: commit 409cc1f8a41 (bond: have random dev address by default instead of zeroes) Reported-by: Greg Rose Signed-off-by: Jiri Pirko --- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 11d01d6..7bd068a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1629,7 +1629,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) /* If this is the first slave, then we need to set the master's hardware * address to be the same as the slave's. */ - if (bond->dev_addr_from_first) + if (bond->slave_cnt == 0 && bond->dev_addr_from_first) bond_set_dev_addr(bond->dev, slave_dev); new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);