]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: mcp2221: Set driver data before I2C adapter add
authorHamish Martin <hamish.martin@alliedtelesis.co.nz>
Wed, 25 Oct 2023 03:55:10 +0000 (16:55 +1300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2025 06:51:54 +0000 (08:51 +0200)
commit0499d5d579d4e552f5c67d74e56b150de31369d5
tree5171bc5d7832ee8e5b336f808c61dc19bb35c294
parent7c2a7b776d63d0aa67fc6f885cf6f35dd795b0c5
HID: mcp2221: Set driver data before I2C adapter add

commit f2d4a5834638bbc967371b9168c0b481519f7c5e upstream.

The process of adding an I2C adapter can invoke I2C accesses on that new
adapter (see i2c_detect()).

Ensure we have set the adapter's driver data to avoid null pointer
dereferences in the xfer functions during the adapter add.

This has been noted in the past and the same fix proposed but not
completed. See:
https://lore.kernel.org/lkml/ef597e73-ed71-168e-52af-0d19b03734ac@vigem.de/

Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sumanth Gavini <sumanth.gavini@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-mcp2221.c