Re: [PATCH] i2c: core: Prevent race condition when removing i2c devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux