public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Sergey Klyaus <Sergey.Klyaus@Tune-IT.Ru>,
	Oliver Neukum <oneukum@suse.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver core: fix race with userland in device_add()
Date: Sat, 9 Aug 2014 07:20:45 -0700	[thread overview]
Message-ID: <20140809142045.GA21904@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1408061610520.1145-100000@iolanthe.rowland.org>

On Wed, Aug 06, 2014 at 04:18:38PM -0400, Alan Stern wrote:
> On Wed, 6 Aug 2014, Sergey Klyaus wrote:
> 
> > Hello.
> > 
> > I wrote a patch that fixes the problem that described above, here are a 
> > patch for 3.16.0+ kernel (cloned from GitHub today). Maybe that "if 
> > (MAJOR(dev->devt)) " part has to go even after BUS_NOTIFY_ADD_DEVICE abd 
> > KOBJ_ADD? I put it before it, because there is no rollback code in 
> > device_add() for that part.
> 
> I think this is fine.  However, I suspect the order of the other calls
> there isn't totally right.  For instance, the
> 
> 	if (parent)
> 		klist_add_tail(&dev->p->knode_parent,
> 			       &parent->p->klist_children);
> 
> part should probably be the first thing after we know the routine can't 
> abort.
> 
> I guess the time when bus_probe_device() gets called doesn't matter 
> much, because the driver might not even be loaded at this point.  But 
> what about all the dev->class stuff at the end of device_add()?  Should 
> that happen before any uevents are sent out?
> 
> Greg, have you looked at this?

I haven't, thanks for pointing it out, I'll put it on my list of things
to do this week.

greg k-h

  reply	other threads:[~2014-08-09 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 13:43 Race condition between userland and USB device attachment Sergey Klyaus
2014-07-28  9:31 ` Oliver Neukum
2014-07-28 14:22   ` Alan Stern
2014-08-06 17:38     ` [PATCH] driver core: fix race with userland in device_add() Sergey Klyaus
2014-08-06 20:18       ` Alan Stern
2014-08-09 14:20         ` Greg Kroah-Hartman [this message]
2014-09-08 22:53         ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2014-10-08  7:31 Sergey Klyaus

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=20140809142045.GA21904@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Sergey.Klyaus@Tune-IT.Ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oneukum@suse.de \
    --cc=stern@rowland.harvard.edu \
    /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