Re: [RFC][PATCH 1/6] RTC subsystem, class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/21/05, Alessandro Zummo <[email protected]> wrote:
> On Tue, 20 Dec 2005 21:01:39 -0500
> Dmitry Torokhov <[email protected]> wrote:
>
>
> > > +if (ops->read_time) {
> > > +memset(tm, 0, sizeof(struct rtc_time));
> > >
> >
> > What guarantees that ops is not NULL here? Userspace can keep the
> > attribute (file) open and issue read after class_device was unregistered
> > and devdata set to NULL.
>
>  Right. For /proc and /dev there's a try_module_get(ops->owner) in place.
>
>  Should I add it to every rtc_sysfs_show_xxx or there's
>  a better way to do it?
>

Well, I don't know what will it buy you: if ops is NULL
try_module_get(ops->owner) will OOPS just as happily as original code.

Your class_device has to hold on to all data structures that are
referenced from sysfs attributes untils its ->release() function is
called. Alternatively you could stuck a mutex and a flag somewhere in
driver data and take it when unregistering class device and also in
all attributes (and chech the flag there).

--
Dmitry
-
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]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux