i2c: Not all adapters have a parent
Subsystems (2)
PATCH 1/1 i2c: Not all adapters have a parent
The code in acpi_i2c_register_devices() assumes that all i2c adapters have a parent. This is not necessarily the case, for example the i2c-stub driver instantiate a virtual i2c adapter without a parent. Check for this to avoid a NULL pointer deference.
--- drivers/i2c/i2c-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i2c/i2c-core.c +3 -0
@@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(stacpi_handle handle;acpi_status status; +if (!adap->dev.parent) +return ; + handle =ACPI_HANDLE (adap->dev.parent);if (!handle)return ;
Signature · 2 lines
Jean Delvare Suse L3 Support
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mika Westerberg
Acked-byQuoted 9 lines · Jean Delvare
The code in
acpi_i2c_register_devices()assumes that all i2c adapters have a parent. This is not necessarily the case, for example the i2c-stub driver instantiate a virtual i2c adapter without a parent. Check for this to avoid a NULL pointer deference.Signed-off-by Jean Delvare <[email protected]>Cc Wolfram Sang <wsa-z923LK4zBo2bacvFa/[email protected]>Cc Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/[email protected]>Cc "Rafael J. Wysocki" <[email protected]>
Oh, I didn't know that. Thanks for the information.
Probably should go to stable as well.
Wolfram Sang
AppliedQuoted 6 lines · Jean Delvare
The code in
acpi_i2c_register_devices()assumes that all i2c adapters have a parent. This is not necessarily the case, for example the i2c-stub driver instantiate a virtual i2c adapter without a parent. Check for this to avoid a NULL pointer deference.Signed-off-by Jean Delvare <[email protected]>
Applied to for-current with stable tag, thanks!
Hi Wolfram, Mika,
Quoted 9 lines · Wolfram Sang
Quoted 6 lines · Jean Delvare
The code in
acpi_i2c_register_devices()assumes that all i2c adapters have a parent. This is not necessarily the case, for example the i2c-stub driver instantiate a virtual i2c adapter without a parent. Check for this to avoid a NULL pointer deference.Signed-off-by Jean Delvare <[email protected]>Applied to for-current with stable tag, thanks!
I don't hit the bug on 3.11. Looking at the code, before it was moved in 3.12-rc1, acpi_i2c_register_devices() was only called explicitly from i2c-designware. So the fix doesn't actually need to go to stable.
Signature · 2 lines
Jean Delvare Suse L3 Support