mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Ming Lei <ming.lei@canonical.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Wedson Almeida Filho <wedsonaf@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Linux PM List <linux-pm@vger.kernel.org>
Subject: Re: Race condition between driver_probe_device and device_shutdown‏
Date: Wed, 23 May 2012 19:14:29 -0700	[thread overview]
Message-ID: <20120524021429.GB12557@kroah.com> (raw)
In-Reply-To: <CACVXFVMqWyT78h53WnLuMYuhfFK-sbGMkS+T8SjWad6kQVFGTw@mail.gmail.com>

On Thu, May 24, 2012 at 09:39:46AM +0800, Ming Lei wrote:
> On Wed, May 23, 2012 at 11:06 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Wed, 23 May 2012, Ming Lei wrote:
> >> The .shutdown callback pointer is got from device->driver, which is
> >> changed in probe and release path. Also runtime PM thing has been
> >> involved into shutting down recently, so looks not only hardware parts
> >> are involved now.
> >
> > This is a tricky question.  Overall I think you're probably right.
> >
> > It's certainly true that holding the device lock across the shutdown
> > callback is the easiest and most reliable way to prevent these races.
> 
> But holding device lock across .shutdown is very inefficient because
> most of devices' driver have not shutdown callback, so I think it is better
> to fix the race by prevent driver core from probing or releasing once
> shutdown is started.
> 
> How about the below patch?

How about waiting for the original poster to respond as to exactly how
they are hitting this race before doing anything?

greg k-h

  reply	other threads:[~2012-05-24  2:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18  4:59 Greg KH
2012-05-20 14:08 ` Ming Lei
2012-05-20 19:51   ` Greg KH
2012-05-21  4:53     ` Ming Lei
2012-05-21 18:29       ` Alan Stern
2012-05-22  0:35         ` Ming Lei
2012-05-22 14:11           ` Alan Stern
2012-05-22 19:16             ` Eric W. Biederman
2012-05-23 10:05               ` Ming Lei
2012-05-23 15:06                 ` Alan Stern
2012-05-24  1:39                   ` Ming Lei
2012-05-24  2:14                     ` Greg KH [this message]
2012-05-24  3:12                       ` Ming Lei
2012-05-24 14:37                       ` Alan Stern
2012-05-25  0:33                         ` Ming Lei
2012-12-06  9:11                           ` Race condition between driver_probe_device and device_shutdown Wedson Almeida Filho
2012-12-06 10:52                             ` Ming Lei
2012-12-07  0:09                               ` Wedson Almeida Filho
2012-12-07  3:42                                 ` Ming Lei
2012-12-07 12:16                                   ` Wedson Almeida Filho
2012-12-07 13:04                                     ` Ming Lei
2012-12-07 15:25                                       ` Alan Stern
2012-12-07 16:27                                         ` Ming Lei
  -- strict thread matches above, loose matches on Subject: below --
2012-05-10  2:53 Race condition between driver_probe_device and device_shutdown‏ Wedson Almeida Filho

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=20120524021429.GB12557@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=stern@rowland.harvard.edu \
    --cc=wedsonaf@gmail.com \
    /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

all inboxes | Powered by JetHome®