Re: [RFCv3] i2c: hold the core_lock for the whole execution of i2c_register_adapter()

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

 



Hi Slawomir,

On Tue, Oct 08, 2019 at 06:39:56PM +0200, Slawomir Stepien wrote:
> From: Sławomir Stępień <slawomir.stepien@xxxxxxxxx>
> 
> There is a race condition between the i2c_get_adapter() and the
> i2c_add_adapter() if this mutex isn't hold for the whole execution of
> i2c_register_adapter().
> 
> If the mutex isn't locked, it is possible to find idr that points to
> adapter that hasn't been registered yet (i.e. it's
> kobj.state_initialized is still false), which will end up with warning
> message:
> 
> "... is not initialized, yet kobject_get() is being called."
> 
> This patch will change how the locking is arranged around
> i2c_register_adapter() call and will prevent such situations. The part
> of the i2c_register_adapter() that do not need to be under the lock has
> been moved to a new function i2c_process_adapter.
> 
> Signed-off-by: Sławomir Stępień <slawomir.stepien@xxxxxxxxx>

Thank you for tackling this one and sorry for the late reply.

Do you have a test case for me so I could reproduce the bad case here?

Kind regards,

   Wolfram

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