From a6964caecf7f3ed202ddc17f1347fafb0fbc1830 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Wed, 6 Oct 2010 11:02:54 -0400 Subject: [PATCH] Resolves: bz 604630 --- kernel.spec | 9 ++++ linux-2.6-bonding-sysfs-warning.patch | 71 +++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 linux-2.6-bonding-sysfs-warning.patch diff --git a/kernel.spec b/kernel.spec index aee6ff194..b2cefdafd 100644 --- a/kernel.spec +++ b/kernel.spec @@ -822,6 +822,9 @@ Patch12581: xen-use-percpu-interrupts-for-ipis-and-virqs.patch # CVE-2010-3432 Patch12590: sctp-do-not-reset-the-packet-during-sctp_packet_config.patch +#Bonding sysfs WARN_ON (bz 604630) +Patch12591: linux-2.6-bonding-sysfs-warning.patch + %endif BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root @@ -1553,6 +1556,9 @@ ApplyPatch xen-use-percpu-interrupts-for-ipis-and-virqs.patch # CVE-2010-3432 ApplyPatch sctp-do-not-reset-the-packet-during-sctp_packet_config.patch +# BZ 604630 +ApplyPatch linux-2.6-bonding-sysfs-warning.patch + # END OF PATCH APPLICATIONS %endif @@ -2174,6 +2180,9 @@ fi %changelog +* Wed Oct 06 2010 Neil Horman +- Fix WARN_ON when you try to create an exiting bond in bond_masters + * Thu Sep 30 2010 Chuck Ebbert - CVE-2010-3432: sctp-do-not-reset-the-packet-during-sctp_packet_config.patch diff --git a/linux-2.6-bonding-sysfs-warning.patch b/linux-2.6-bonding-sysfs-warning.patch new file mode 100644 index 000000000..42fc297a7 --- /dev/null +++ b/linux-2.6-bonding-sysfs-warning.patch @@ -0,0 +1,71 @@ +From: Neil Horman +Date: Tue, 5 Oct 2010 03:39:21 +0000 (+0000) +Subject: bonding: fix WARN_ON when writing to bond_master sysfs file +X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fdavem%2Fnet-2.6.git;a=commitdiff_plain;h=27e6f065df132b5270014d3285889b15185e9da9 + +bonding: fix WARN_ON when writing to bond_master sysfs file + +Fix a WARN_ON failure in bond_masters sysfs file + +Got a report of this warning recently + +bonding: bond0 is being created... +------------[ cut here ]------------ +WARNING: at fs/proc/generic.c:590 proc_register+0x14d/0x185() +Hardware name: ProLiant BL465c G1 +proc_dir_entry 'bonding/bond0' already registered +Modules linked in: bonding ipv6 tg3 bnx2 shpchp amd64_edac_mod edac_core +ipmi_si +ipmi_msghandler serio_raw i2c_piix4 k8temp edac_mce_amd hpwdt microcode hpsa +cc +iss radeon ttm drm_kms_helper drm i2c_algo_bit i2c_core [last unloaded: +scsi_wai +t_scan] +Pid: 935, comm: ifup-eth Not tainted 2.6.33.5-124.fc13.x86_64 #1 +Call Trace: +[] warn_slowpath_common+0x77/0x8f +[] warn_slowpath_fmt+0x3c/0x3e +[] proc_register+0x14d/0x185 +[] proc_create_data+0x87/0xa1 +[] bond_create_proc_entry+0x55/0x95 [bonding] +[] bond_init+0x95/0xd0 [bonding] +[] register_netdevice+0xdd/0x29e +[] bond_create+0x8e/0xb8 [bonding] +[] bonding_store_bonds+0xb3/0x1c1 [bonding] +[] class_attr_store+0x27/0x29 +[] sysfs_write_file+0x10f/0x14b +[] vfs_write+0xa9/0x106 +[] sys_write+0x45/0x69 +[] system_call_fastpath+0x16/0x1b +---[ end trace a677c3f7f8b16b1e ]--- +bonding: Bond creation failed. + +It happens because a user space writer to bond_master can try to +register an already existing bond interface name. Fix it by teaching +bond_create to check for the existance of devices with that name first +in cases where a non-NULL name parameter has been passed in + +Signed-off-by: Neil Horman +Signed-off-by: David S. Miller +--- + +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c +index 3b16f62..e953c6a 100644 +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -5164,6 +5164,15 @@ int bond_create(struct net *net, const char *name) + res = dev_alloc_name(bond_dev, "bond%d"); + if (res < 0) + goto out; ++ } else { ++ /* ++ * If we're given a name to register ++ * we need to ensure that its not already ++ * registered ++ */ ++ res = -EEXIST; ++ if (__dev_get_by_name(net, name) != NULL) ++ goto out; + } + + res = register_netdevice(bond_dev);