All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Lin Ming <ming.m.lin@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>, Len Brown <lenb@kernel.org>,
	"Moore, Robert" <robert.moore@intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: Re: [origin tree boot crash] NULL pointer dereference, IP: [<ffffffff82b07130>] ibm_find_acpi_device+0x5c/0xf5
Date: Fri, 25 Sep 2009 15:47:14 -0600	[thread overview]
Message-ID: <1253915234.16789.14.camel@dc7800.home> (raw)
In-Reply-To: <1253758420.9794.59.camel@minggr.sh.intel.com>

On Thu, 2009-09-24 at 10:13 +0800, Lin Ming wrote:
> On Thu, 2009-09-24 at 09:58 +0800, Lin Ming wrote:
> > On Thu, 2009-09-24 at 09:35 +0800, Lin Ming wrote:
> > > On Thu, 2009-09-24 at 05:30 +0800, Ingo Molnar wrote:
> > > > > commit 15b8dd53f5ffaf8e2d9095c423f713423f576c0f
> > > > > Date:   Mon Jun 29 13:39:29 2009 +0800
> > > > >
> > > > >     ACPICA: Major update for acpi_get_object_info external interface
> > > > 
> > > > this one is causing boot crashes in -tip testing: 

> hp-agp.c need the same fix.
> Could you refresh your patch with this one?

I think Len has already applied the series containing the acpiphp_ibm.c
fix.  I tested that one and verified that it fixed an actual crash.

I think your hp-agp.c patch below is correct, and I don't object if you
want to submit it, but I don't *think* we'll have a problem even without
it.

We will only touch "info->hardware_id.string[]" if we have already found
an HP vendor-defined CSR space descriptor.  Any device with that
descriptor should have a HID.

Bjorn

> diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
> index 7bead4c..d83c4a8 100644
> --- a/drivers/char/agp/hp-agp.c
> +++ b/drivers/char/agp/hp-agp.c
> @@ -492,8 +492,10 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
>  		status = acpi_get_object_info(handle, &info);
>  		if (ACPI_SUCCESS(status)) {
>  			/* TBD check _CID also */
> -			info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0';
> -			match = (strcmp(info->hardware_id.string, "HWP0001") == 0);
> +			if (info->valid & ACPI_VALID_HID)
> +				match = !strcmp(info->hardware_id.string, "HWP0001");
> +			else
> +				match = 0;
>  			kfree(info);
>  			if (match) {
>  				status = hp_acpi_csr_space(handle, &sba_hpa, &length);
> 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) ||
> 
> 
> > 
> > Below patch should fix the crash.
> > http://patchwork.kernel.org/patch/49090/ 
> > 
> > Subject: [PATCH v3 01/17] ACPICA: fixup after acpi_get_object_info() change
> > 
> > Commit 15b8dd53f5ffa changed info->hardware_id from a static array to
> > a pointer.  If hardware_id is non-NULL, it points to a NULL-terminated
> > string, so we don't need to terminate it explicitly.  However, it may
> > be NULL; in that case, we *can't* add a NULL terminator.
> > 
> > This causes a NULL pointer dereference oops for devices without _HID.
> > 
> > Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> > CC: Lin Ming <ming.m.lin@intel.com>
> > CC: Bob Moore <robert.moore@intel.com>
> > CC: Gary Hade <garyhade@us.ibm.com>
> > ---
> >  drivers/pci/hotplug/acpiphp_ibm.c |    1 -
> >  1 files changed, 0 insertions(+), 1 deletions(-)
> > 
> > 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) ||
> > 
> > 
> > ---
> > Lin Ming
> > 
> > > 
> > > commit 718fb0de8ff88f71b3b91a8ee8e42e60c88e5128
> > > Author: Hugh Dickins <hugh.dickins@tiscali.co.uk>
> > > Date:   Thu Aug 6 23:18:12 2009 +0000
> > > 
> > >     ACPI: fix NULL bug for HID/UID string
> > >     
> > >     acpi_device->pnp.hardware_id and unique_id are now allocated pointers,
> > >     replacing the previous arrays.  acpi_device_install_notify_handler()
> > >     oopsed on the NULL hid when probing the video device, and perhaps other
> > >     uses are vulnerable too.  So initialize those pointers to empty strings
> > >     when there is no hid or uid.  Also, free hardware_id and unique_id when
> > >     when acpi_device is going to be freed.
> > >     
> > >     http://bugzilla.kernel.org/show_bug.cgi?id=14096
> > >     
> > >     Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
> > >     Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> > >     Signed-off-by: Len Brown <len.brown@intel.com>
> > > 
> > > Thanks,
> > > Lin Ming
> > 
> 


  reply	other threads:[~2009-09-25 21:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-19  6:42 [git pull request] ACPI & driver patches for Linux-2.6.32-rc0 Len Brown
2009-09-23 21:30 ` [origin tree boot crash] NULL pointer dereference, IP: [<ffffffff82b07130>] ibm_find_acpi_device+0x5c/0xf5 Ingo Molnar
2009-09-24  1:35   ` Lin Ming
2009-09-24  1:58     ` Lin Ming
2009-09-24  2:13       ` Lin Ming
2009-09-25 21:47         ` Bjorn Helgaas [this message]
2009-09-25 12:08 ` [git pull request] ACPI & driver patches for Linux-2.6.32-rc0 Thomas Backlund
     [not found]   ` <d3f22a0909261902o5e48c2a0lab56fca21edf8c5b@mail.gmail.com>
2009-09-27  1:55     ` Lin Ming
2009-09-27  7:50       ` Len Brown
2009-09-28 20:18         ` Thomas Backlund
2009-09-28 20:44           ` Alexey Starikovskiy
2009-09-28 20:44             ` Alexey Starikovskiy
2009-09-28 21:31             ` Thomas Backlund
2009-09-28 21:31               ` Thomas Backlund
2009-09-28 21:44               ` Thomas Backlund
2009-09-28 22:12                 ` Alexey Starikovskiy
2009-09-28 22:12                   ` Alexey Starikovskiy
2009-09-29  0:32                   ` Thomas Backlund
2009-09-29  0:32                     ` Thomas Backlund
2009-09-29  8:25                     ` Alexey Starikovskiy
2009-09-29 17:42                       ` Thomas Backlund
2009-09-29 17:42                         ` Thomas Backlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1253915234.16789.14.camel@dc7800.home \
    --to=bjorn.helgaas@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=robert.moore@intel.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.