Re: kernel BUG at fs/sysfs/symlink.c:87

From: Stephen Hemminger
Date: Tue Jan 25 2005 - 15:41:55 EST


I can't reproduce this with 2.6.11-rc2, could you try this patch to
see if it matters.

Puzzled, because the assert is.
BUG_ON(!kobj || !kobj->dentry || !name);
and call is

err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj,
SYSFS_BRIDGE_PORT_LINK);
kobj can't be NULL, because &p->kobj can't be NULL
kobj->dentry is created by kobject_add
name is SYSFS_BRIDGE_PORT_LINK ("bridge")

The kobj->dentry should have been created by kobject_add()

kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
p->kobj.ktype = &brport_ktype;
p->kobj.parent = &(p->dev->class_dev.kobj);
p->kobj.kset = NULL;

err = kobject_add(&p->kobj);
and kobject_add does.
err = create_dir(kobj);
create_dir calls sysfs_create_dir(kobj).
===================

Since kobject_register initializes more fields, perhaps some part of kobject_add
got confused. Try this.

diff -Nru a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
--- a/net/bridge/br_sysfs_if.c 2005-01-25 12:28:00 -08:00
+++ b/net/bridge/br_sysfs_if.c 2005-01-25 12:28:00 -08:00
@@ -229,7 +229,7 @@
p->kobj.parent = &(p->dev->class_dev.kobj);
p->kobj.kset = NULL;

- err = kobject_add(&p->kobj);
+ err = kobject_register(&p->kobj);
if(err)
goto out1;

-
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/