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