Skip to content

Commit 969affd

Browse files
committed
sysfs: remove BUG_ON() from sysfs_remove_group()
It's possible that the caller of sysfs_remove_group messed up and passed in an attribute group that was not really registered to this kobject. But don't panic for such a foolish error, spit out a warning about what happened, and continue on our way safely. Cc: Roland Dreier <rdreier@cisco.com> Cc: Tejun Heo <htejun@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 7d640c4 commit 969affd

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎fs/sysfs/group.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ void sysfs_remove_group(struct kobject * kobj,
7777

7878
if (grp->name) {
7979
sd = sysfs_get_dirent(dir_sd, grp->name);
80-
BUG_ON(!sd);
80+
if (!sd) {
81+
printk(KERN_WARNING "sysfs group %p not found for "
82+
"kobject '%s'\n", grp, kobject_name(kobj));
83+
WARN_ON(!sd);
84+
return;
85+
}
8186
} else
8287
sd = sysfs_get(dir_sd);
8388

0 commit comments

Comments
 (0)