public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Slawomir Stepien <sst@poczta.fm>
Cc: linux-i2c@vger.kernel.org, krzysztof.adamski@nokia.com,
	jakub.lewalski@nokia.com, slawomir.stepien@nokia.com,
	alexander.sverdlin@nokia.com
Subject: Re: [RFCv3] i2c: hold the core_lock for the whole execution of i2c_register_adapter()
Date: Sat, 21 Mar 2020 20:15:32 +0100	[thread overview]
Message-ID: <20200321191532.GF5632@ninjato> (raw)
In-Reply-To: <20191008163956.GB566933@t480s.localdomain>

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

Hi Slawomir,

On Tue, Oct 08, 2019 at 06:39:56PM +0200, Slawomir Stepien wrote:
> From: Sławomir Stępień <slawomir.stepien@nokia.com>
> 
> 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@nokia.com>

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

       reply	other threads:[~2020-03-21 19:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191008163956.GB566933@t480s.localdomain>
2020-03-21 19:15 ` Wolfram Sang [this message]
2020-03-27 14:01   ` [RFCv3] i2c: hold the core_lock for the whole execution of i2c_register_adapter() Slawomir Stepien

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=20200321191532.GF5632@ninjato \
    --to=wsa@the-dreams.de \
    --cc=alexander.sverdlin@nokia.com \
    --cc=jakub.lewalski@nokia.com \
    --cc=krzysztof.adamski@nokia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=slawomir.stepien@nokia.com \
    --cc=sst@poczta.fm \
    /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