From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
Bob Moore <robert.moore@intel.com>
Subject: [PATCH 13/18] ACPICA: Resources: Not a valid resource if buffer length too long
Date: Wed, 28 Dec 2016 15:29:28 +0800 [thread overview]
Message-ID: <49f31626f7caa6fa927e879cf1ffe773143824eb.1482821486.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1482821486.git.lv.zheng@intel.com>
From: Bob Moore <robert.moore@intel.com>
ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
The declared buffer length must be the same as the length of the
byte initializer list, otherwise not a valid resource descriptor.
Link: https://github.com/acpica/acpica/commit/9f76de2d
Link: https://github.com/acpica/acpica/commit/b2e89d72
Link: https://github.com/acpica/acpica/commit/23b5bbe6
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
drivers/acpi/acpica/utresrc.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 1de3376..2ad99ea 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -421,8 +421,10 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
- /* The absolute minimum resource template is one end_tag descriptor */
-
+ /*
+ * The absolute minimum resource template is one end_tag descriptor.
+ * However, we will treat a lone end_tag as just a simple buffer.
+ */
if (aml_length < sizeof(struct aml_resource_end_tag)) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
@@ -454,9 +456,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
/* Invoke the user function */
if (user_function) {
- status =
- user_function(aml, length, offset, resource_index,
- context);
+ status = user_function(aml, length, offset,
+ resource_index, context);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -480,6 +481,12 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
*context = aml;
}
+ /* Check if buffer is defined to be longer than the resource length */
+
+ if (aml_length > (offset + length)) {
+ return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+ }
+
/* Normal exit */
return_ACPI_STATUS(AE_OK);
--
2.7.4
next prev parent reply other threads:[~2016-12-28 7:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 7:28 [PATCH 00/18] ACPICA 20161222 Release Lv Zheng
2016-12-28 7:28 ` [PATCH 01/18] ACPICA: Debugger: Rename debugger OSL names Lv Zheng
2016-12-28 7:28 ` [PATCH 02/18] ACPICA: Hardware: Remove bit_offset masking support Lv Zheng
2016-12-28 7:28 ` [PATCH 03/18] ACPICA: Hardware: Add access_width/bit_offset support in acpi_hw_write() Lv Zheng
2016-12-28 7:28 ` [PATCH 04/18] ACPICA: Utilities: Add power of two rounding support Lv Zheng
2016-12-28 7:28 ` [PATCH 05/18] ACPICA: Hardware: Sort access bit width algorithm Lv Zheng
2016-12-28 7:28 ` [PATCH 06/18] ACPICA: Macro header: Fix some typos in comments. No functional change Lv Zheng
2016-12-28 7:28 ` [PATCH 07/18] ACPICA: Hardware: Add sleep register hooks Lv Zheng
2016-12-28 7:28 ` [PATCH 08/18] ACPICA: Linux-specific header: Add support for s390x compilation Lv Zheng
2016-12-28 7:29 ` [PATCH 09/18] ACPICA: MSVC: Fix MSVC6 build issues Lv Zheng
2016-12-28 7:29 ` [PATCH 10/18] ACPICA: EFI: Add efihello demo application Lv Zheng
2016-12-28 7:29 ` [PATCH 11/18] ACPICA: Disassembler: Add Switch/Case disassembly support Lv Zheng
2016-12-28 7:29 ` [PATCH 12/18] ACPICA: Utilities: Update debug output Lv Zheng
2016-12-28 7:29 ` Lv Zheng [this message]
2016-12-28 7:29 ` [PATCH 15/18] ACPICA: Parser: Allow method invocations as target operands Lv Zheng
2016-12-28 7:29 ` [PATCH 16/18] ACPICA: Fix a problem with recent extra support for control method invocations Lv Zheng
2016-12-28 7:29 ` [PATCH 17/18] ACPICA: Parser: Update parse info table for some operators Lv Zheng
2016-12-28 7:30 ` [PATCH 18/18] ACPICA: Update version to 20161222 Lv Zheng
2017-01-02 22:19 ` [PATCH 00/18] ACPICA 20161222 Release Rafael J. Wysocki
2017-01-03 5:23 ` Zheng, Lv
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=49f31626f7caa6fa927e879cf1ffe773143824eb.1482821486.git.lv.zheng@intel.com \
--to=lv.zheng@intel.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@intel.com \
--cc=zetalog@gmail.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
all inboxes | Powered by JetHome®