Re: [linux-usb-devel] [PATCH] back out sysfs reference count change

From: Alan Stern
Date: Thu Apr 01 2004 - 09:58:24 EST


On Thu, 1 Apr 2004, Maneesh Soni wrote:

> On Wed, Mar 31, 2004 at 10:11:37AM -0500, Alan Stern wrote:
> >
> > Here's a suggestion. At the start of check_perm() grab the dentry
> > semaphore, then check whether d_fsdata is NULL, if it isn't then do the
> > kobject_get(), then unlock the semaphore.
> >
>
> I have tried this with no luck. I still get
> (Badness in kobject_get at lib/kobject.c:42) which means it is not correct fix.

Did you remember to set dentry->d_fsdata to NULL? This has to be done in
sysfs_remove_dir() sometime during the period when dentry->d_inode->i_sem
is held. Right now the pointer to the kobject never gets erased. That
Badness message is an indication that you are using a valid pointer to a
kobject whose refcount is 0.

Alan Stern

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