On Wed, Aug 10, 2005 at 03:36:36PM +0530, Maneesh Soni wrote:
> On Wed, Aug 10, 2005 at 04:26:51PM +1000, Keith Owens wrote:
> > FYI, the intermittent free after use in sysfs is still there in
> > 2.6.13-rc6.
> >
>
> The race condition is known here. It is some thing in the upper layer.
> In this case "driver/base/class.c" which frees the kobject's attributes
> even if there are live references to kobject.
>
>
> open sysfs file unregister class device
> sysfs_open_file() class_device_del()
> -> takes a ref on kobject -> kfree attribute struct
> -> accesses attributes -> kobject_del()
> -> kref_put()
> close sysfs file
> sysfs_release()
> -> acesses attributes using s_element
> -> drops ref to kobject
>
> Solution could be either we have reference counting for attributes also
> or keep attributes alive till the last reference to the kobject. Both these
> needs changes in the driver core.
>
> Greg, will the following patch make sense? This postpones the kfree() of
> devt_attr till class_dev_release() is called.
Yes, that patch looks good, if you fix up the space vs. tabs issue :)
But will that really fix this race? I was under the impression the oops
didn't come from trying to access the devt_attr, but the sysfs s_element
pointer?
> Please check this patch out, if this helps or not.
I'd be interested in seeing if this fixes it.
thanks,
greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|