Skip to contentSkip to conversation

sysfs -- don't crash if removing non-existant attribute group

PATCH In review Stephen Hemminger 2 participants 2 messages Oct 13, 2003 – Oct 14, 2003 1 message not in the archive Driver core

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 sysfs -- don't crash if removing non-existant attribute group

Some (buggy) network drivers in 2.6 decide to set the statistics hook, after registration. This causes unregister_netdevice to crash because it attempts to remove the 'statistics' attribute group it thought was created.

This fixes sysfs so it ignores the problem. Another set of patches will address the remaining buggy ether drivers.

fs/sysfs/group.c +4 -2
diff -Nru a/fs/sysfs/group.c b/fs/sysfs/group.c
@@ -65,9 +65,11 @@
 {
 	struct dentry * dir;
 
-	if (grp->name)
+	if (grp->name) {
 		dir = sysfs_get_dentry(kobj->dentry,grp->name);
-	else
+		if (dir == NULL)	/* non-existent */
+			return;
+	} else
 		dir = kobj->dentry;
 
 	remove_files(dir,grp);
#2 lore raw
Quoted 2 lines · On Mon, 13 Oct 2003 16:25:59 -0700 Stephen Hemminger <[email protected]>…

This fixes sysfs so it ignores the problem. Another set of patches will address the remaining buggy ether drivers.

Please change this patch to add a net_ratelimit()'d warning message so that we can catch new instances of this problem.

Thanks.