* [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() @ 2013-05-23 12:44 Hanjun Guo 2013-05-28 23:30 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Hanjun Guo @ 2013-05-23 12:44 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: linux-acpi, linux-kernel, patches, linaro-kernel In acpi_processor_add(), get_cpu_device() will return NULL sometimes, although the chances are small, I think it should be fixed. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> --- drivers/acpi/processor_driver.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index bec717f..dd64f23 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -579,6 +579,10 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) per_cpu(processors, pr->id) = pr; dev = get_cpu_device(pr->id); + if (!dev) { + result = -ENODEV; + goto err_clear_processor; + } if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) { result = -EFAULT; goto err_clear_processor; -- 1.7.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-23 12:44 [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() Hanjun Guo @ 2013-05-28 23:30 ` Rafael J. Wysocki 2013-05-29 1:38 ` Hanjun Guo 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2013-05-28 23:30 UTC (permalink / raw) To: Hanjun Guo; +Cc: linux-acpi, linux-kernel, patches, linaro-kernel On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: > In acpi_processor_add(), get_cpu_device() will return NULL sometimes, > although the chances are small, I think it should be fixed. > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> This patch isn't necessary any more after the changes queued up for 3.11 in the acpi-hotplug branch of the linux-pm.git tree. Thanks, Rafael > --- > drivers/acpi/processor_driver.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c > index bec717f..dd64f23 100644 > --- a/drivers/acpi/processor_driver.c > +++ b/drivers/acpi/processor_driver.c > @@ -579,6 +579,10 @@ static int __cpuinit acpi_processor_add(struct acpi_device > *device) > per_cpu(processors, pr->id) = pr; > > dev = get_cpu_device(pr->id); > + if (!dev) { > + result = -ENODEV; > + goto err_clear_processor; > + } > if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) { > result = -EFAULT; > goto err_clear_processor; > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-28 23:30 ` Rafael J. Wysocki @ 2013-05-29 1:38 ` Hanjun Guo 2013-05-29 11:07 ` Martin Mokrejs 0 siblings, 1 reply; 9+ messages in thread From: Hanjun Guo @ 2013-05-29 1:38 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: linux-acpi, linux-kernel, patches, linaro-kernel On 2013-5-29 7:30, Rafael J. Wysocki wrote: > On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: >> In acpi_processor_add(), get_cpu_device() will return NULL sometimes, >> although the chances are small, I think it should be fixed. >> >> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> > > This patch isn't necessary any more after the changes queued up for 3.11 > in the acpi-hotplug branch of the linux-pm.git tree. Ok, I noticed your patch set, just drop my patch. Thanks Hanjun > > Thanks, > Rafael > > >> --- >> drivers/acpi/processor_driver.c | 4 ++++ >> 1 files changed, 4 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c >> index bec717f..dd64f23 100644 >> --- a/drivers/acpi/processor_driver.c >> +++ b/drivers/acpi/processor_driver.c >> @@ -579,6 +579,10 @@ static int __cpuinit acpi_processor_add(struct acpi_device >> *device) >> per_cpu(processors, pr->id) = pr; >> >> dev = get_cpu_device(pr->id); >> + if (!dev) { >> + result = -ENODEV; >> + goto err_clear_processor; >> + } >> if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) { >> result = -EFAULT; >> goto err_clear_processor; >> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-29 1:38 ` Hanjun Guo @ 2013-05-29 11:07 ` Martin Mokrejs 2013-05-30 2:29 ` Hanjun Guo 0 siblings, 1 reply; 9+ messages in thread From: Martin Mokrejs @ 2013-05-29 11:07 UTC (permalink / raw) To: Hanjun Guo, Rafael J. Wysocki Cc: linux-acpi, linux-kernel, patches, linaro-kernel Hanjun Guo wrote: > On 2013-5-29 7:30, Rafael J. Wysocki wrote: >> On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: >>> In acpi_processor_add(), get_cpu_device() will return NULL sometimes, >>> although the chances are small, I think it should be fixed. >>> >>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> >> >> This patch isn't necessary any more after the changes queued up for 3.11 >> in the acpi-hotplug branch of the linux-pm.git tree. > > Ok, I noticed your patch set, just drop my patch. But shouldn't this go to stable at least? I checked linux-3.9.4 and it applies fine. Whether this is relevant for other stable series I will leave up to somebody else. ;) Martin > > Thanks > Hanjun > >> >> Thanks, >> Rafael >> >> >>> --- >>> drivers/acpi/processor_driver.c | 4 ++++ >>> 1 files changed, 4 insertions(+), 0 deletions(-) >>> >>> diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c >>> index bec717f..dd64f23 100644 >>> --- a/drivers/acpi/processor_driver.c >>> +++ b/drivers/acpi/processor_driver.c >>> @@ -579,6 +579,10 @@ static int __cpuinit acpi_processor_add(struct acpi_device >>> *device) >>> per_cpu(processors, pr->id) = pr; >>> >>> dev = get_cpu_device(pr->id); >>> + if (!dev) { >>> + result = -ENODEV; >>> + goto err_clear_processor; >>> + } >>> if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) { >>> result = -EFAULT; >>> goto err_clear_processor; >>> > > -- > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-29 11:07 ` Martin Mokrejs @ 2013-05-30 2:29 ` Hanjun Guo 2013-05-30 13:57 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Hanjun Guo @ 2013-05-30 2:29 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Martin Mokrejs, linux-acpi, linux-kernel, patches, linaro-kernel On 2013-5-29 19:07, Martin Mokrejs wrote: > Hanjun Guo wrote: >> On 2013-5-29 7:30, Rafael J. Wysocki wrote: >>> On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: >>>> In acpi_processor_add(), get_cpu_device() will return NULL sometimes, >>>> although the chances are small, I think it should be fixed. >>>> >>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> >>> >>> This patch isn't necessary any more after the changes queued up for 3.11 >>> in the acpi-hotplug branch of the linux-pm.git tree. >> >> Ok, I noticed your patch set, just drop my patch. > > But shouldn't this go to stable at least? I checked linux-3.9.4 > and it applies fine. Whether this is relevant for other stable > series I will leave up to somebody else. ;) Hi Rafeal, What's your opinion on Martin's suggestion? Thanks Hanjun > Martin ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-30 2:29 ` Hanjun Guo @ 2013-05-30 13:57 ` Rafael J. Wysocki 2013-05-30 22:25 ` Greg Kroah-Hartman 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2013-05-30 13:57 UTC (permalink / raw) To: Hanjun Guo, Greg Kroah-Hartman Cc: Martin Mokrejs, linux-acpi, linux-kernel, patches, linaro-kernel On Thursday, May 30, 2013 10:29:54 AM Hanjun Guo wrote: > On 2013-5-29 19:07, Martin Mokrejs wrote: > > Hanjun Guo wrote: > >> On 2013-5-29 7:30, Rafael J. Wysocki wrote: > >>> On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: > >>>> In acpi_processor_add(), get_cpu_device() will return NULL sometimes, > >>>> although the chances are small, I think it should be fixed. > >>>> > >>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> > >>> > >>> This patch isn't necessary any more after the changes queued up for 3.11 > >>> in the acpi-hotplug branch of the linux-pm.git tree. > >> > >> Ok, I noticed your patch set, just drop my patch. > > > > But shouldn't this go to stable at least? I checked linux-3.9.4 > > and it applies fine. Whether this is relevant for other stable > > series I will leave up to somebody else. ;) > > Hi Rafeal, > > What's your opinion on Martin's suggestion? Well, this is kind of hard to say. We generally don't apply patches to -stable that don't have mainline counterparts. Greg, I wonder what your opinion is? Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-30 13:57 ` Rafael J. Wysocki @ 2013-05-30 22:25 ` Greg Kroah-Hartman 2013-05-31 3:58 ` Hanjun Guo 0 siblings, 1 reply; 9+ messages in thread From: Greg Kroah-Hartman @ 2013-05-30 22:25 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Hanjun Guo, Martin Mokrejs, linux-acpi, linux-kernel, patches, linaro-kernel On Thu, May 30, 2013 at 03:57:58PM +0200, Rafael J. Wysocki wrote: > On Thursday, May 30, 2013 10:29:54 AM Hanjun Guo wrote: > > On 2013-5-29 19:07, Martin Mokrejs wrote: > > > Hanjun Guo wrote: > > >> On 2013-5-29 7:30, Rafael J. Wysocki wrote: > > >>> On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: > > >>>> In acpi_processor_add(), get_cpu_device() will return NULL sometimes, > > >>>> although the chances are small, I think it should be fixed. > > >>>> > > >>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> > > >>> > > >>> This patch isn't necessary any more after the changes queued up for 3.11 > > >>> in the acpi-hotplug branch of the linux-pm.git tree. > > >> > > >> Ok, I noticed your patch set, just drop my patch. > > > > > > But shouldn't this go to stable at least? I checked linux-3.9.4 > > > and it applies fine. Whether this is relevant for other stable > > > series I will leave up to somebody else. ;) > > > > Hi Rafeal, > > > > What's your opinion on Martin's suggestion? > > Well, this is kind of hard to say. We generally don't apply patches to -stable > that don't have mainline counterparts. > > Greg, I wonder what your opinion is? We do not apply patches to -stable that are not in Linus's tree, unless there is no problem in Linus's tree due to a major rewrite of the code, and it has been confirmed that the same problem isn't there. thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-30 22:25 ` Greg Kroah-Hartman @ 2013-05-31 3:58 ` Hanjun Guo 2013-05-31 12:08 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Hanjun Guo @ 2013-05-31 3:58 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Greg Kroah-Hartman, Martin Mokrejs, linux-acpi, linux-kernel, patches, linaro-kernel [-- Attachment #1: Type: text/plain, Size: 1677 bytes --] On 2013-5-31 6:25, Greg Kroah-Hartman wrote: > On Thu, May 30, 2013 at 03:57:58PM +0200, Rafael J. Wysocki wrote: >> On Thursday, May 30, 2013 10:29:54 AM Hanjun Guo wrote: >>> On 2013-5-29 19:07, Martin Mokrejs wrote: >>>> Hanjun Guo wrote: >>>>> On 2013-5-29 7:30, Rafael J. Wysocki wrote: >>>>>> On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: >>>>>>> In acpi_processor_add(), get_cpu_device() will return NULL sometimes, >>>>>>> although the chances are small, I think it should be fixed. >>>>>>> >>>>>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> >>>>>> >>>>>> This patch isn't necessary any more after the changes queued up for 3.11 >>>>>> in the acpi-hotplug branch of the linux-pm.git tree. >>>>> >>>>> Ok, I noticed your patch set, just drop my patch. >>>> >>>> But shouldn't this go to stable at least? I checked linux-3.9.4 >>>> and it applies fine. Whether this is relevant for other stable >>>> series I will leave up to somebody else. ;) >>> >>> Hi Rafeal, >>> >>> What's your opinion on Martin's suggestion? >> >> Well, this is kind of hard to say. We generally don't apply patches to -stable >> that don't have mainline counterparts. >> >> Greg, I wonder what your opinion is? > > We do not apply patches to -stable that are not in Linus's tree, unless > there is no problem in Linus's tree due to a major rewrite of the code, > and it has been confirmed that the same problem isn't there. Hi Rafael, I found that the problem is still there in your acpi-hotplug tree, sorry for I didn't noticed early. I made a patch for this again, I hope it will make sense to you. The patch is attached, based on your acpi-hotplug tree. Thanks Hanjun [-- Attachment #2: 0001-ACPI-processor-Fix-potential-NULL-pointer-dereferenc.patch --] [-- Type: text/plain, Size: 1085 bytes --] >From 975e30f5906a883e533e4226d8eca1c449c7366b Mon Sep 17 00:00:00 2001 From: Hanjun Guo <hanjun.guo@linaro.org> Date: Fri, 31 May 2013 11:36:08 +0800 Subject: [PATCH 1/1] ACPI / processor: Fix potential NULL pointer dereference in acpi_processor_add() In acpi_processor_add(), get_cpu_device() will return NULL in some cases, and ACPI_HANDLE_SET() just use the return dev directly, this will case a potential NULL pointer dereference, fix it. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> --- drivers/acpi/acpi_processor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 587d2af..4466b36 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -389,6 +389,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device, per_cpu(processor_device_array, pr->id) = device; dev = get_cpu_device(pr->id); + if (!dev) { + result = -ENODEV; + goto err; + } + ACPI_HANDLE_SET(dev, pr->handle); result = acpi_bind_one(dev, NULL); if (result) -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() 2013-05-31 3:58 ` Hanjun Guo @ 2013-05-31 12:08 ` Rafael J. Wysocki 0 siblings, 0 replies; 9+ messages in thread From: Rafael J. Wysocki @ 2013-05-31 12:08 UTC (permalink / raw) To: Hanjun Guo Cc: Greg Kroah-Hartman, Martin Mokrejs, linux-acpi, linux-kernel, patches, linaro-kernel On Friday, May 31, 2013 11:58:49 AM Hanjun Guo wrote: > On 2013-5-31 6:25, Greg Kroah-Hartman wrote: > > On Thu, May 30, 2013 at 03:57:58PM +0200, Rafael J. Wysocki wrote: > >> On Thursday, May 30, 2013 10:29:54 AM Hanjun Guo wrote: > >>> On 2013-5-29 19:07, Martin Mokrejs wrote: > >>>> Hanjun Guo wrote: > >>>>> On 2013-5-29 7:30, Rafael J. Wysocki wrote: > >>>>>> On Thursday, May 23, 2013 08:44:26 PM Hanjun Guo wrote: > >>>>>>> In acpi_processor_add(), get_cpu_device() will return NULL sometimes, > >>>>>>> although the chances are small, I think it should be fixed. > >>>>>>> > >>>>>>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> > >>>>>> > >>>>>> This patch isn't necessary any more after the changes queued up for 3.11 > >>>>>> in the acpi-hotplug branch of the linux-pm.git tree. > >>>>> > >>>>> Ok, I noticed your patch set, just drop my patch. > >>>> > >>>> But shouldn't this go to stable at least? I checked linux-3.9.4 > >>>> and it applies fine. Whether this is relevant for other stable > >>>> series I will leave up to somebody else. ;) > >>> > >>> Hi Rafeal, > >>> > >>> What's your opinion on Martin's suggestion? > >> > >> Well, this is kind of hard to say. We generally don't apply patches to -stable > >> that don't have mainline counterparts. > >> > >> Greg, I wonder what your opinion is? > > > > We do not apply patches to -stable that are not in Linus's tree, unless > > there is no problem in Linus's tree due to a major rewrite of the code, > > and it has been confirmed that the same problem isn't there. > > Hi Rafael, > > I found that the problem is still there in your acpi-hotplug tree, sorry for > I didn't noticed early. I made a patch for this again, I hope it will make > sense to you. > > The patch is attached, based on your acpi-hotplug tree. OK, thanks! Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-05-31 11:59 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-23 12:44 [PATCH] ACPI: Fix potential NULL pointer dereference in acpi_processor_add() Hanjun Guo 2013-05-28 23:30 ` Rafael J. Wysocki 2013-05-29 1:38 ` Hanjun Guo 2013-05-29 11:07 ` Martin Mokrejs 2013-05-30 2:29 ` Hanjun Guo 2013-05-30 13:57 ` Rafael J. Wysocki 2013-05-30 22:25 ` Greg Kroah-Hartman 2013-05-31 3:58 ` Hanjun Guo 2013-05-31 12:08 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox