From: Dmitry Torokhov <dtor_core@ameritech.net>
To: matthieu castet <castet.matthieu@free.fr>
Cc: Greg KH <greg@kroah.com>,
Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: device_remove_file and disconnect
Date: Sat, 2 Jul 2005 23:54:51 -0500 [thread overview]
Message-ID: <200507022354.52015.dtor_core@ameritech.net> (raw)
In-Reply-To: <42C722F9.8060809@free.fr>
On Saturday 02 July 2005 18:27, matthieu castet wrote:
> Hi,
> matthieu castet wrote:
> >>
> >>
> >> Then they should be fixed. Any specific examples?
> >>
> >>
> > I am a little lasy to list all, but some drivers in driver/usb should
> > have this problem : the first driver I look : ./misc/phidgetkit.c do
> > [1]. So sysfs read don't check if to_usb_interface or usb_get_intfdata
> > return NULL pointer...
> > And it is a bit your fault, as many developper should have read your
> > great tutorial [2] ;)
> >
> >>> Also I always see driver free their privatre data in device disconnect,
> >>> so if read/write from sysfs aren't serialized with device disconnect
> >>> there are still a possible race like I show in my example.
> >>
> >>
> >>
> >> Yes, you are correct. Again, any specific drivers you see with this
> >> problem?
> >
> > I believe near all drivers that use sysfs via device_create_file, as I
> > never see them use mutex in read/write in order to check there aren't in
> > the same time in their disconnect that could free there private data
> > when they do operation on it...
> >
> >
> > Couldn't be possible the make device_remove_file blocking until all the
> > open file are closed ?
> >
I don't think we want "rmmod <moudule> < /sys/..../attribute" wedge the box.
> > thanks,
> >
> > Matthieu
> >
> > [1]
> > #define show_input(value) \
> > static ssize_t show_input##value(struct device *dev, char *buf) \
> > { \
> > struct usb_interface *intf = to_usb_interface(dev); \
> > struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
> > \
> > return sprintf(buf, "%d\n", kit->inputs[value - 1]); \
> > } \
> > static DEVICE_ATTR(input##value, S_IRUGO, show_input##value, NULL);
> >
> > [2] http://www.linuxjournal.com/article/7353
> >
>
> So will there be a fix in the kernel, or all this driver are broken and
> should be fixed ?
>
I think the drivers should be fixed, most likely with the help of bus code
they are on.
--
Dmitry
next prev parent reply other threads:[~2005-07-03 4:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-29 16:59 device_remove_file and disconnect matthieu castet
2005-06-29 18:46 ` Greg KH
2005-06-29 20:17 ` matthieu castet
2005-06-29 22:42 ` Greg KH
2005-06-30 7:26 ` mat
2005-06-30 17:04 ` Greg KH
2005-06-30 20:31 ` matthieu castet
2005-07-02 23:27 ` matthieu castet
2005-07-03 4:54 ` Dmitry Torokhov [this message]
2005-07-25 1:54 ` Greg KH
2005-06-30 20:36 ` Dmitry Torokhov
2005-07-03 4:38 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200507022354.52015.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=castet.matthieu@free.fr \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.