diff options
| author | Johan Hovold <johan@kernel.org> | 2026-05-11 16:37:12 +0200 |
|---|---|---|
| committer | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2026-05-30 23:57:19 +0200 |
| commit | ba14d7cf2fe7284610a29854bdff22b2537d3ce6 (patch) | |
| tree | 720c126bd42846350473cc74788e2795752a0db5 /scripts | |
| parent | 3e2041ea586ae37fcea918ecb505ab9972a1201d (diff) | |
i2c: core: fix adapter registration race
Adapters can be looked up based on their id using i2c_get_adapter()
which takes a reference to the embedded struct device.
Make sure that the adapter (including its struct device) has been
initialised before adding it to the IDR to avoid accessing uninitialised
data which could, for example, lead to NULL-pointer dereferences or
use-after-free.
Note that the i2c-dev chardev, which is registered from a bus notifier,
currently uses i2c_get_adapter() so the adapter needs to be added to the
IDR before registration.
Fixes: 6e13e6418418 ("i2c: Add i2c_add_numbered_adapter()")
Cc: stable@vger.kernel.org # 2.6.22
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
