Re: [patch] lockdep annotate vlan net device as being a special class

From: Peter Staubach
Date: Tue Jun 27 2006 - 10:15:14 EST


Arjan van de Ven wrote:

On Thu, 2006-06-15 at 16:40 +0200, deweerdt@xxxxxxx wrote:


Hi,

Assigning an inet address to a vlanized interface triggered the following BUG
from the lock validator (kernel is 2.6.17-rc6-mm2):



ok below is a real working (cross my fingers) patch against the current
-mm tree:

vlan network devices have devices nesting below it, and are a special
"super class" of normal network devices; split their locks off into a
separate class since they always nest.

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
net/8021q/vlan.c | 10 ++++++++++
1 file changed, 10 insertions(+)

Index: linux-2.6.17-lockdep/net/8021q/vlan.c
===================================================================
--- linux-2.6.17-lockdep.orig/net/8021q/vlan.c
+++ linux-2.6.17-lockdep/net/8021q/vlan.c
@@ -364,6 +364,14 @@ static void vlan_transfer_operstate(cons
}
}

+/*
+ * vlan network devices have devices nesting below it, and are a special
+ * "super class" of normal network devices; split their locks off into a
+ * separate class since they always nest.
+ */
+static struct lock_class_key vlan_netdev_xmit_lock_key;
+
+
/* Attach a VLAN device to a mac address (ie Ethernet Card).
* Returns the device that was created, or NULL if there was
* an error of some kind.
@@ -460,6 +468,8 @@ static struct net_device *register_vlan_
new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name,
vlan_setup);
+
+ lockdep_set_class(&new_dev->_xmit_lock, &vlan_netdev_xmit_lock_key);
if (new_dev == NULL)
goto out_unlock;


Shouldn't this test for new_dev being NULL _before_ it gets used?

Thanx...

ps
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/