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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 9 Jan 2014 19:20:39 +0800
From:	Ding Tianhong <dingtianhong@...wei.com>
To:	Jay Vosburgh <fubar@...ibm.com>,
	Veaceslav Falico <vfalico@...hat.com>,
	"David S. Miller" <davem@...emloft.net>,
	Netdev <netdev@...r.kernel.org>
Subject: [PATCH net-next 2/4] bonding: do not save non-existent device to
 bond primary in check params

When install the bonding, the primay will be use to distinguish
the primary slave for ab, alb and tlb mode, but it is meanless
to save a no existed device, so add check for it.

Signed-off-by: Ding Tianhong <dingtianhong@...wei.com>
---
 drivers/net/bonding/bond_main.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index de646e2..651c5fd 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4246,13 +4246,19 @@ static int bond_check_params(struct bond_params *params)
 		pr_debug("Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.\n");
 	}
 
-	if (primary && !USES_PRIMARY(bond_mode)) {
-		/* currently, using a primary only makes sense
-		 * in active backup, TLB or ALB modes
-		 */
-		pr_warning("Warning: %s primary device specified but has no effect in %s mode\n",
-			   primary, bond_mode_name(bond_mode));
-		primary = NULL;
+	if (primary) {
+		if (!__dev_get_by_name(&init_net, primary)) {
+			pr_warn("Warning: %s primary device is not exist\n",
+				primary);
+			primary = NULL;
+		} else if (!USES_PRIMARY(bond_mode)) {
+			/* currently, using a primary only makes sense
+			 * in active backup, TLB or ALB modes
+			 */
+			pr_warn("Warning: %s primary device specified but has no effect in %s mode\n",
+				primary, bond_mode_name(bond_mode));
+			primary = NULL;
+		}
 	}
 
 	if (primary && primary_reselect) {
-- 
1.8.0


--
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