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>] [day] [month] [year] [list]
Message-Id: <200701200215.l0K2Fl22021913@death.nxdomain.ibm.com>
Date:	Fri, 19 Jan 2007 18:15:47 -0800
From:	Jay Vosburgh <fubar@...ibm.com>
To:	netdev@...r.kernel.org, bonding-devel@...ts.sourceforge.net
Cc:	Jeff Garzik <jgarzik@...ox.com>, Patrick McHardy <kaber@...sh.net>,
	mitch.a.williams@...el.com
Subject: [PATCH 3/4] bonding: modify sysfs support to permit multiple loads


	The existing code would blindly attempt to create the
bonding_masters file (in /sys/class/net) every time the module was
loaded.  When the module is loaded multiple times (which is the
historical method used by initscripts and sysconfig to create multiple
bonding interfaces), this caused load failure of the second module load
attempt, as the creation request would fail.

	This changes the code to note the failure, arrange to not remove
the bonding_masters file upon module exit, and then return success.

	Bonding interfaces created by the second or subsequent loads of
the module will not exist in bonding_masters.  This is not a significant
change, as previously only the interfaces from the most recent load of
the module would be listed.  Both situations are less than optimal, but
this case permits compatibility with existing distro configuration
scripts, and is consistent.

	Note that previously, the sysfs create request would overwrite
the exsting bonding_masters file and succeed, allowing multiple loads of
the module.  The sysfs code has recently changed to return an error if
the file being created already exists.

	Patrick McHardy <kaber@...sh.net>, who reported this problem,
observed crashes on the old kernel (before sysfs checked for
duplicates).  I did not experience such crashes, but this change should
resolve them.

Signed-off-by: Jay Vosburgh <fubar@...ibm.com>



diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ced9ed8..8e317e1 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1372,6 +1372,21 @@ int bond_create_sysfs(void)
 		return -ENODEV;
 
 	ret = class_create_file(netdev_class, &class_attr_bonding_masters);
+	/*
+	 * Permit multiple loads of the module by ignoring failures to
+	 * create the bonding_masters sysfs file.  Bonding devices
+	 * created by second or subsequent loads of the module will
+	 * not be listed in, or controllable by, bonding_masters, but
+	 * will have the usual "bonding" sysfs directory.
+	 *
+	 * This is done to preserve backwards compatibility for
+	 * initscripts/sysconfig, which load bonding multiple times to
+	 * configure multiple bonding devices.
+	 */
+	if (ret == -EEXIST) {
+		netdev_class = NULL;
+		return 0;
+	}
 
 	return ret;
 
-
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