From: Jay Vosburgh <fubar@us.ibm.com>
To: netdev@vger.kernel.org
Cc: Jeff Garzik <jgarzik@pobox.com>, Jay Vosburgh <fubar@us.ibm.com>
Subject: [PATCH 3/7] bonding: fix NULL pointer deref in startup processing
Date: Tue, 29 Jan 2008 18:07:45 -0800 [thread overview]
Message-ID: <12016588712034-git-send-email-fubar@us.ibm.com> (raw)
In-Reply-To: <12016588714065-git-send-email-fubar@us.ibm.com>
Fix the "are we creating a duplicate" check to not compare
the name if the name is NULL (meaning that the system should select
a name). Bug reported by Benny Amorsen <benny+usenet@amorsen.dk>.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 591b8b4..63866da 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4896,14 +4896,16 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
down_write(&bonding_rwsem);
/* Check to see if the bond already exists. */
- list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
- if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
- printk(KERN_ERR DRV_NAME
+ if (name) {
+ list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
+ if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
+ printk(KERN_ERR DRV_NAME
": cannot add bond %s; it already exists\n",
- name);
- res = -EPERM;
- goto out_rtnl;
- }
+ name);
+ res = -EPERM;
+ goto out_rtnl;
+ }
+ }
bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
ether_setup);
--
1.5.3.4.206.g58ba4-dirty
next prev parent reply other threads:[~2008-01-30 2:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-30 2:07 [PATCH 0/7] bonding: miscellaneous fixes Jay Vosburgh
2008-01-30 2:07 ` [PATCH 1/7] bonding: fix parameter parsing Jay Vosburgh
2008-01-30 2:07 ` [PATCH 2/7] bonding: fix set_multicast_list locking Jay Vosburgh
2008-01-30 2:07 ` Jay Vosburgh [this message]
2008-01-30 2:07 ` [PATCH 4/7] bonding: fix race that causes invalid statistics Jay Vosburgh
2008-01-30 2:07 ` [PATCH 5/7] bonding: do not acquire rtnl in ARP monitor Jay Vosburgh
2008-01-30 2:07 ` [PATCH 6/7] bonding: update version Jay Vosburgh
2008-01-30 2:07 ` [PATCH 7/7] bonding: update MAINTAINERS Jay Vosburgh
2008-01-30 8:38 ` [PATCH 1/7] bonding: fix parameter parsing Jeff Garzik
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=12016588712034-git-send-email-fubar@us.ibm.com \
--to=fubar@us.ibm.com \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).