mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [Patch -mm 2/2] driver core: Introduce device_move(): move a device
Date: Wed, 22 Nov 2006 17:45:30 +0100	[thread overview]
Message-ID: <20061122174530.4efa1145@gondolin.boeblingen.de.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0611221024340.3038-100000@iolanthe.rowland.org>

On Wed, 22 Nov 2006 10:32:47 -0500 (EST),
Alan Stern <stern@rowland.harvard.edu> wrote:

> Cornelia Huck wrote:
> 
> > +	if (old_parent)
> > +		klist_del(&dev->knode_parent);
> > +	klist_add_tail(&dev->knode_parent, &new_parent->klist_children);
> 
> > +			klist_del(&dev->knode_parent);
> > +			if (old_parent)
> > +				klist_add_tail(&dev->knode_parent,
> > 						&old_parent->klist_children);
> 
> This is wrong.  klist_del() does not wait for the knode to be removed from
> its klist.  You need to use klist_remove().

Hmpf, you're right.

> I don't see any protection against new_parent being removed while dev is
> being transferred under it.  Are you relying on the caller to make sure
> this never happens?

Is there any mechanism in the driver core to avoid such races? The only
locking I can see are klists and dev->sem (which only protects
probing). AFAICS, the caller needs to ensure consistency anyway (like
with the subchannel mutex we introduced in s390 to ensure device
register and unregister cannot be called concurrently).

-- 
Cornelia Huck
Linux for zSeries Developer
Tel.: +49-7031-16-4837, Mail: cornelia.huck@de.ibm.com

  reply	other threads:[~2006-11-22 16:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-22 15:32 Alan Stern
2006-11-22 16:45 ` Cornelia Huck [this message]
2006-11-22 16:49   ` [Patch -mm] driver core: Use klist_remove() in device_move() Cornelia Huck
2006-11-22 17:37   ` [Patch -mm 2/2] driver core: Introduce device_move(): move a device Alan Stern

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=20061122174530.4efa1145@gondolin.boeblingen.de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®