public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Peter Rosin <peda@axentia.se>
Cc: David Thomson <david.thomson@alliedtelesis.co.nz>,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH] i2c: core: Prevent race condition when removing i2c devices
Date: Mon, 31 Jul 2017 15:38:14 +0200	[thread overview]
Message-ID: <20170731133814.b5lyujdl5iwhcalx@ninjato> (raw)
In-Reply-To: <2e4c5807-3d3c-1ce2-da35-3e37b2e3b08b@axentia.se>

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

On Mon, Jun 19, 2017 at 09:30:06PM +0200, Peter Rosin wrote:
> On 2017-06-19 18:34, Peter Rosin wrote:
> > It would certainly be nice to know why .owner is clobbered, because I
> > don't see it. But then again, I don't know what sources I should be
> > reading...
>
> BTW, one thing I noticed when reading the current code is that I see this
> at the end of i2c_del_adapter:
>
> 	/* Clear the device structure in case this adapter is ever going to be
> 	   added again */
> 	memset(&adap->dev, 0, sizeof(adap->dev));
> }
> EXPORT_SYMBOL(i2c_del_adapter);

It was added with commit bd4bc3dbded9cd ("i2c: Clear i2c_adapter.dev on
adapter removal") with this commit message:

    i2c: Clear i2c_adapter.dev on adapter removal

    Clear i2c_adapter.dev on adapter removal. This makes it possible to
    re-add the adapter at a later point, which some drivers
    (i2c-amd756-s4882, i2c-nforce2-s4985) actually do.

    This fixes a bug reported by John Stultz here:
      http://lkml.org/lkml/2008/7/15/720
    and by Ingo Molar there:
      http://lkml.org/lkml/2008/7/16/78

So, despite the docs, it used to be an issue actually...


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-07-31 13:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08  2:43 [PATCH] i2c: core: Prevent race condition when removing i2c devices David Thomson
2017-06-19 14:36 ` Wolfram Sang
2017-06-19 16:34   ` Peter Rosin
2017-06-19 19:30     ` Peter Rosin
2017-06-28 22:20       ` David Thomson
2017-08-18  8:04         ` Peter Rosin
2017-07-31 13:38       ` Wolfram Sang [this message]
2017-07-31 14:02         ` Peter Rosin
2017-07-31 14:11           ` Wolfram Sang

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=20170731133814.b5lyujdl5iwhcalx@ninjato \
    --to=wsa@the-dreams.de \
    --cc=david.thomson@alliedtelesis.co.nz \
    --cc=linux-i2c@vger.kernel.org \
    --cc=peda@axentia.se \
    /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