public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>, Bob Moore <robert.moore@intel.com>
Cc: Len Brown <len.brown@intel.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yinghai Lu <yinghai@kernel.org>,
	Mattia Dongili <malattia@linux.it>,
	Matthew Garrett <matthew.garrett@nebula.com>,
	Adam Belay <abelay@mit.edu>, Bjorn Helgaas <bhelgaas@google.com>,
	platform-driver-x86@vger.kernel.org
Subject: [PATCH] ACPI: Set length even for TYPE_END_TAG acpi resource
Date: Sat, 23 Mar 2013 12:16:37 -0700	[thread overview]
Message-ID: <1364066197-11670-1-git-send-email-yinghai@kernel.org> (raw)

Found with pm/linux-next, network device in QEMU/KVM guest does not
work anymore.

Bisected to commit c13085e5
    ACPICA: Resource Mgr: Prevent infinite loops in resource walks

That commit will check acpi_resource length strictly.
it cause acpi_set_current_resources return failure and irq for pci device
is not set properly.

Set length for all those TYPE_END_TAG acpi_resources.

Bisected-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Mattia Dongili <malattia@linux.it>
Cc: Matthew Garrett <matthew.garrett@nebula.com>
Cc: Adam Belay <abelay@mit.edu>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: platform-driver-x86@vger.kernel.org

---
 drivers/acpi/pci_link.c            |    1 +
 drivers/platform/x86/sony-laptop.c |    3 ++-
 drivers/pnp/pnpacpi/rsparser.c     |    1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/acpi/pci_link.c
===================================================================
--- linux-2.6.orig/drivers/acpi/pci_link.c
+++ linux-2.6/drivers/acpi/pci_link.c
@@ -354,6 +354,7 @@ static int acpi_pci_link_set(struct acpi
 
 	}
 	resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
+	resource->end.length = sizeof(struct acpi_resource);
 
 	/* Attempt to set the resource */
 	status = acpi_set_current_resources(link->device->handle, &buffer);
Index: linux-2.6/drivers/platform/x86/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/platform/x86/sony-laptop.c
+++ linux-2.6/drivers/platform/x86/sony-laptop.c
@@ -4121,7 +4121,7 @@ static int sony_pic_enable(struct acpi_d
 		resource->res3.data.irq.sharable = ACPI_SHARED;
 
 		resource->res4.type = ACPI_RESOURCE_TYPE_END_TAG;
-
+		resource->res4.length = sizeof(struct acpi_resource);
 	}
 	/* setup Type 2/3 resources */
 	else {
@@ -4140,6 +4140,7 @@ static int sony_pic_enable(struct acpi_d
 		resource->res2.data.irq.sharable = ACPI_SHARED;
 
 		resource->res3.type = ACPI_RESOURCE_TYPE_END_TAG;
+		resource->res3.length = sizeof(struct acpi_resource);
 	}
 
 	/* Attempt to set the resource */
Index: linux-2.6/drivers/pnp/pnpacpi/rsparser.c
===================================================================
--- linux-2.6.orig/drivers/pnp/pnpacpi/rsparser.c
+++ linux-2.6/drivers/pnp/pnpacpi/rsparser.c
@@ -634,6 +634,7 @@ int pnpacpi_build_resource_template(stru
 	}
 	/* resource will pointer the end resource now */
 	resource->type = ACPI_RESOURCE_TYPE_END_TAG;
+	resource->length = sizeof(struct acpi_resource);
 
 	return 0;
 }

             reply	other threads:[~2013-03-23 19:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 19:16 Yinghai Lu [this message]
2013-03-26 13:38 ` [PATCH] ACPI: Set length even for TYPE_END_TAG acpi resource Rafael J. Wysocki

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=1364066197-11670-1-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=abelay@mit.edu \
    --cc=bhelgaas@google.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malattia@linux.it \
    --cc=matthew.garrett@nebula.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=robert.moore@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox