bonding: fix NULL pointer deref in startup processing
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> Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
80ee5ad231
commit
4fe4763cd8
@ -4896,6 +4896,7 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
|
|||||||
down_write(&bonding_rwsem);
|
down_write(&bonding_rwsem);
|
||||||
|
|
||||||
/* Check to see if the bond already exists. */
|
/* Check to see if the bond already exists. */
|
||||||
|
if (name) {
|
||||||
list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
|
list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
|
||||||
if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
|
if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
|
||||||
printk(KERN_ERR DRV_NAME
|
printk(KERN_ERR DRV_NAME
|
||||||
@ -4904,6 +4905,7 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
|
|||||||
res = -EPERM;
|
res = -EPERM;
|
||||||
goto out_rtnl;
|
goto out_rtnl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
|
bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
|
||||||
ether_setup);
|
ether_setup);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user