aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2013-05-08 00:01:15 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-05-08 09:31:37 -0400
commit61388f9e5d93053cf399a356414f31f9b4814c6d (patch)
treef50814ce10be2256c65aeb83dbd4482733486fff
parent371deb9500831ad1afbf9ea00e373f650deaed2f (diff)
ACPICA: Fix possible buffer overflow during a field unit read operation
Can only happen under these conditions: 1) The DSDT version is 1, meaning integers are 32-bits. 2) The field is between 33 and 64 bits long. It applies cleanly back to ACPICA 20100806+ (Linux v2.6.37+). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: 2.6.37+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/exfldio.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index ec7f5690031b..c84ee956fa4c 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -720,7 +720,19 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
720 720
721 if ((obj_desc->common_field.start_field_bit_offset == 0) && 721 if ((obj_desc->common_field.start_field_bit_offset == 0) &&
722 (obj_desc->common_field.bit_length == access_bit_width)) { 722 (obj_desc->common_field.bit_length == access_bit_width)) {
723 status = acpi_ex_field_datum_io(obj_desc, 0, buffer, ACPI_READ); 723 if (buffer_length >= sizeof(u64)) {
724 status =
725 acpi_ex_field_datum_io(obj_desc, 0, buffer,
726 ACPI_READ);
727 } else {
728 /* Use raw_datum (u64) to handle buffers < 64 bits */
729
730 status =
731 acpi_ex_field_datum_io(obj_desc, 0, &raw_datum,
732 ACPI_READ);
733 ACPI_MEMCPY(buffer, &raw_datum, buffer_length);
734 }
735
724 return_ACPI_STATUS(status); 736 return_ACPI_STATUS(status);
725 } 737 }
726 738