* [PATCH] i2c: Not all adapters have a parent @ 2013-10-10 6:04 Jean Delvare [not found] ` <20131010080406.3e0fd78e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Jean Delvare @ 2013-10-10 6:04 UTC (permalink / raw) To: Linux I2C; +Cc: Wolfram Sang, Mika Westerberg, Rafael J. Wysocki 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-l3A5Bk7waGM@public.gmane.org> Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> Cc: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Cc: "Rafael J. Wysocki" <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20131010080406.3e0fd78e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>]
* Re: [PATCH] i2c: Not all adapters have a parent [not found] ` <20131010080406.3e0fd78e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> @ 2013-10-10 6:15 ` Mika Westerberg 2013-10-10 7:35 ` Wolfram Sang 1 sibling, 0 replies; 4+ messages in thread From: Mika Westerberg @ 2013-10-10 6:15 UTC (permalink / raw) To: Jean Delvare; +Cc: Linux I2C, Wolfram Sang, Rafael J. Wysocki 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-l3A5Bk7waGM@public.gmane.org> > Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> > Cc: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> > Cc: "Rafael J. Wysocki" <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Oh, I didn't know that. Thanks for the information. Acked-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Probably should go to stable as well. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: Not all adapters have a parent [not found] ` <20131010080406.3e0fd78e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 2013-10-10 6:15 ` Mika Westerberg @ 2013-10-10 7:35 ` Wolfram Sang 2013-10-10 7:45 ` Jean Delvare 1 sibling, 1 reply; 4+ messages in thread From: Wolfram Sang @ 2013-10-10 7:35 UTC (permalink / raw) To: Jean Delvare; +Cc: Linux I2C, Mika Westerberg, Rafael J. Wysocki [-- Attachment #1: Type: text/plain, Size: 456 bytes --] 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-l3A5Bk7waGM@public.gmane.org> Applied to for-current with stable tag, thanks! [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: Not all adapters have a parent 2013-10-10 7:35 ` Wolfram Sang @ 2013-10-10 7:45 ` Jean Delvare 0 siblings, 0 replies; 4+ messages in thread From: Jean Delvare @ 2013-10-10 7:45 UTC (permalink / raw) To: Wolfram Sang; +Cc: Linux I2C, Mika Westerberg, Rafael J. Wysocki 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-l3A5Bk7waGM@public.gmane.org> > > 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. -- Jean Delvare Suse L3 Support ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-10 7:45 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-10 6:04 [PATCH] i2c: Not all adapters have a parent Jean Delvare [not found] ` <20131010080406.3e0fd78e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 2013-10-10 6:15 ` Mika Westerberg 2013-10-10 7:35 ` Wolfram Sang 2013-10-10 7:45 ` Jean Delvare
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).