Re: Flaw in the driver-model implementation of attributes

From: viro@parcelfarce.linux.theplanet.co.uk
Date: Mon Jun 16 2003 - 13:03:44 EST


On Mon, Jun 16, 2003 at 01:54:34PM -0400, Alan Stern wrote:

> > IMO, if you don't own the object (and therefore don't know its lifetime),
> > you shouldn't be adding sysfs or device model attributes of any kind to
> > that object.
>
> That's not practical. How else can a device driver provide
> device-specific configuration options or information in sysfs? In many
> cases the device is owned by the bus, not the device driver.

Practical or not, when you put sysfs object into a structure, you take
full responsibility for the lifetime of that structure. Period.

Note that problems exist even when kernel is non-modular. Even if code
stays in place, the data getting freed under you is just as bad. And
that can trivially happen without any modules.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:18 EST