Subject: Re: FW: next-20090724: null pointer dereference from ibm_find_acpi_device

From: Lin Ming <[email-masked]>
Date: Mon, 27 Jul 2009 17:03:57 +0800

Hi, Thomas

Would you please try below patch?

info->hardware_id.string[sizeof(info->hardware_id.length) - 1] = '\0' is
not needed anymore because acpi_get_object_info already handles it.

        /* Allocate a buffer for the HID */

        hid =
            ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) +
                                 (acpi_size) length);

And it would cause null pointer deference if info->hardware_id.string is
NULL.

So delete it.

diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index a9d926b..e7be66d 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -406,7 +406,6 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
 			__func__, status);
 		return retval;
 	}
-	info->hardware_id.string[sizeof(info->hardware_id.length) - 1] = '\0';
 
 	if (info->current_status && (info->valid & ACPI_VALID_HID) &&
 			(!strcmp(info->hardware_id.string, IBM_HARDWARE_ID1) ||

On Mon, 2009-07-27 at 13:09 +0800, Moore, Robert wrote:
> Lin Ming,
> 
> Can you take a look at this?
> 
> Thanks
> Bob
> 
> 
> -----Original Message-----
> From: Thomas Meyer [mailto:[email-masked]] 
> Sent: Sunday, July 26, 2009 3:15 AM
> To: Moore, Robert; Brown, Len; [email-masked]
> Subject: next-20090724: null pointer dereference from ibm_find_acpi_device
> 
> Hi.
> 
> Probably caused by commit fbe8cddd2d85979d273d7937a2b8a47498694d91.
> 
> See attached screenshot.
>