Patchwork bond_3ad.c avoid possible null deref

login
register
mail settings
Submitter Dan Carpenter
Date Dec. 23, 2009, 1:27 p.m.
Message ID <20091223132710.GE17923@bicker>
Download mbox | patch
Permalink /patch/41665/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - Dec. 23, 2009, 1:27 p.m.
A few lines earlier we assume that best->slave could be either null or non-null so 
we should check it here as well.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Dec. 27, 2009, 4:26 a.m.
From: Dan Carpenter <error27@gmail.com>
Date: Wed, 23 Dec 2009 15:27:10 +0200

> A few lines earlier we assume that best->slave could be either null or non-null so 
> we should check it here as well.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- orig/drivers/net/bonding/bond_3ad.c	2009-12-23 00:06:58.000000000 +0200
+++ devel/drivers/net/bonding/bond_3ad.c	2009-12-23 00:07:31.000000000 +0200
@@ -1580,7 +1580,7 @@  static void ad_agg_selection_logic(struc
 		// check if any partner replys
 		if (best->is_individual) {
 			pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n",
-				   best->slave->dev->master->name);
+				   best->slave ? best->slave->dev->master->name : "NULL");
 		}
 
 		best->is_active = 1;