Message ID | 20131010080406.3e0fd78e@endymion.delvare |
---|---|
State | Accepted |
Headers | show |
On Thu, Oct 10, 2013 at 08:04:06AM +0200, Jean Delvare wrote: > 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 <jdelvare@suse.de> > Cc: Wolfram Sang <wsa@the-dreams.de> > Cc: Mika Westerberg <mika.westerberg@linux.intel.com> > Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Oh, I didn't know that. Thanks for the information. Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Probably should go to stable as well. -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Oct 10, 2013 at 08:04:06AM +0200, Jean Delvare wrote: > 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 <jdelvare@suse.de> Applied to for-current with stable tag, thanks!
Hi Wolfram, Mika, Le Thursday 10 October 2013 à 09:35 +0200, Wolfram Sang a écrit : > On Thu, Oct 10, 2013 at 08:04:06AM +0200, Jean Delvare wrote: > > 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 <jdelvare@suse.de> > > 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.
--- 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;
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 <jdelvare@suse.de> Cc: Wolfram Sang <wsa@the-dreams.de> Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> --- drivers/i2c/i2c-core.c | 3 +++ 1 file changed, 3 insertions(+)