public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ding Tianhong <dingtianhong@huawei•com>
To: Jay Vosburgh <fubar@us•ibm.com>,
	Veaceslav Falico <vfalico@redhat•com>,
	"David S. Miller" <davem@davemloft•net>,
	Netdev <netdev@vger•kernel.org>
Subject: [PATCH net-next 3/4] bonding: do not save non-existent device to bond primary in sysfs
Date: Thu, 9 Jan 2014 19:20:54 +0800	[thread overview]
Message-ID: <52CE8616.2010902@huawei.com> (raw)

Do not save non-existent device to bond primary in sysfs.

Signed-off-by: Ding Tianhong <dingtianhong@huawei•com>
---
 drivers/net/bonding/bond_options.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 945a666..9b4518f 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -501,6 +501,12 @@ int bond_option_primary_set(struct bonding *bond, const char *primary)
 		goto out;
 	}
 
+	if (!__dev_get_by_name(dev_net(bond->dev), primary)) {
+		pr_err("%s: unable to set non-existent device %s to primary.\n",
+		       bond->dev->name, primary);
+		goto out;
+	}
+
 	bond_for_each_slave(bond, slave, iter) {
 		if (strncmp(slave->dev->name, primary, IFNAMSIZ) == 0) {
 			pr_info("%s: Setting %s as primary slave.\n",
-- 
1.8.0

             reply	other threads:[~2014-01-09 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 11:20 Ding Tianhong [this message]
2014-01-09 11:47 ` [PATCH net-next 3/4] bonding: do not save non-existent device to bond primary in sysfs Veaceslav Falico

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=52CE8616.2010902@huawei.com \
    --to=dingtianhong@huawei$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=fubar@us$(echo .)ibm.com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=vfalico@redhat$(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