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 <[email protected]>
Cc: Mika Westerberg <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
---
 drivers/i2c/i2c-core.c |    3 +++
 1 file changed, 3 insertions(+)

--- linux-3.12-rc4.orig/drivers/i2c/i2c-core.c  2013-09-24 00:41:09.000000000 
+0200
+++ linux-3.12-rc4/drivers/i2c/i2c-core.c       2013-10-10 07:46:12.244886047 
+0200
@@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(st
        acpi_handle handle;
        acpi_status status;
 
+       if (!adap->dev.parent)
+               return;
+
        handle = ACPI_HANDLE(adap->dev.parent);
        if (!handle)
                return;


-- 
Jean Delvare
Suse L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to