public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: matthieu castet <castet.matthieu@free.fr>
To: Greg KH <greg@kroah.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: device_remove_file and disconnect
Date: Wed, 29 Jun 2005 22:17:59 +0200	[thread overview]
Message-ID: <42C301F7.4010309@free.fr> (raw)
In-Reply-To: <20050629184621.GA28447@kroah.com>

Hi,

Greg KH wrote:
> On Wed, Jun 29, 2005 at 06:59:00PM +0200, matthieu castet wrote:
> 
>>Hi,
>>
>>I have a question about sysfs interface.
>>
>>If you open a sysfs file created by a module, then remove it (rmmoding 
>>the module that create this sysfs file), then try to read the opened 
>>file, you often get strange result (segdefault or oppps).
> 
> 
> What file did you do this for?  The module count should be incremented
> if you do this, to prevent the module from being unloaded.
> 
Ok, but if we unplug a device, then disconnect will be called even if we 
opened a sysfs file.

Couldn't be a race between the moment we read our private data and check 
it is valid and the moment we use it :

Process A (read/write sysfs file) 		Process B (disconnect)
recover our private data from struct device
check it is valid
						free our private data
do operation on private data


>>If it is the first case, I fear that lot's of modules are broken.
> 
> 
> Remember, only root can unload modules, so it really isn't _that_ big of
> a deal (I can do a lot more damage as root than just oopsing the
> kernel...)
> 
Yes I know, but fewer possible opps won't hurt ;)

thanks

Matthieu

  reply	other threads:[~2005-06-29 20:18 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 [this message]
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
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=42C301F7.4010309@free.fr \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox