diff options
author | Lin Ming <ming.m.lin@intel.com> | 2008-04-10 11:06:43 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-22 15:35:19 -0400 |
commit | 7a5bb9964512c5313af19310c6a3002ec54f7336 (patch) | |
tree | 2508740652210f8115c7237e8763238d909106ef | |
parent | 0ba7d25c70699cdd3e06fc049d8884ee54b9d5db (diff) |
ACPICA: Fix to handle NULL package elements correctly
Fixed problem where NULL package elements were not returned to
the AcpiEvaluateObject interface correctly. Instead of returning a
NULL ACPI_OBJECT package element, the element was simply ignored,
potentially causing a buffer overflow and/or confusing the caller
who expected a fixed number of elements.
http://bugzilla.kernel.org/show_bug.cgi?id=10132
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/acpi/utilities/utobject.c | 5 | ||||
-rw-r--r-- | include/acpi/actypes.h | 29 |
2 files changed, 19 insertions, 15 deletions
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 1eccd3db876f..cdb8ff5b92d1 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -470,9 +470,8 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
470 | case ACPI_TYPE_PROCESSOR: | 470 | case ACPI_TYPE_PROCESSOR: |
471 | case ACPI_TYPE_POWER: | 471 | case ACPI_TYPE_POWER: |
472 | 472 | ||
473 | /* | 473 | /* No extra data for these types */ |
474 | * No extra data for these types | 474 | |
475 | */ | ||
476 | break; | 475 | break; |
477 | 476 | ||
478 | case ACPI_TYPE_LOCAL_REFERENCE: | 477 | case ACPI_TYPE_LOCAL_REFERENCE: |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 599657eac2d4..75ec153338e7 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -639,46 +639,51 @@ typedef u8 acpi_adr_space_type; | |||
639 | /* | 639 | /* |
640 | * External ACPI object definition | 640 | * External ACPI object definition |
641 | */ | 641 | */ |
642 | |||
643 | /* | ||
644 | * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element | ||
645 | * or an unresolved named reference. | ||
646 | */ | ||
642 | union acpi_object { | 647 | union acpi_object { |
643 | acpi_object_type type; /* See definition of acpi_ns_type for values */ | 648 | acpi_object_type type; /* See definition of acpi_ns_type for values */ |
644 | struct { | 649 | struct { |
645 | acpi_object_type type; | 650 | acpi_object_type type; /* ACPI_TYPE_INTEGER */ |
646 | acpi_integer value; /* The actual number */ | 651 | acpi_integer value; /* The actual number */ |
647 | } integer; | 652 | } integer; |
648 | 653 | ||
649 | struct { | 654 | struct { |
650 | acpi_object_type type; | 655 | acpi_object_type type; /* ACPI_TYPE_STRING */ |
651 | u32 length; /* # of bytes in string, excluding trailing null */ | 656 | u32 length; /* # of bytes in string, excluding trailing null */ |
652 | char *pointer; /* points to the string value */ | 657 | char *pointer; /* points to the string value */ |
653 | } string; | 658 | } string; |
654 | 659 | ||
655 | struct { | 660 | struct { |
656 | acpi_object_type type; | 661 | acpi_object_type type; /* ACPI_TYPE_BUFFER */ |
657 | u32 length; /* # of bytes in buffer */ | 662 | u32 length; /* # of bytes in buffer */ |
658 | u8 *pointer; /* points to the buffer */ | 663 | u8 *pointer; /* points to the buffer */ |
659 | } buffer; | 664 | } buffer; |
660 | 665 | ||
661 | struct { | 666 | struct { |
662 | acpi_object_type type; | 667 | acpi_object_type type; /* ACPI_TYPE_PACKAGE */ |
663 | u32 fill1; | ||
664 | acpi_handle handle; /* object reference */ | ||
665 | } reference; | ||
666 | |||
667 | struct { | ||
668 | acpi_object_type type; | ||
669 | u32 count; /* # of elements in package */ | 668 | u32 count; /* # of elements in package */ |
670 | union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ | 669 | union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ |
671 | } package; | 670 | } package; |
672 | 671 | ||
673 | struct { | 672 | struct { |
674 | acpi_object_type type; | 673 | acpi_object_type type; /* ACPI_TYPE_LOCAL_REFERENCE */ |
674 | acpi_object_type actual_type; /* Type associated with the Handle */ | ||
675 | acpi_handle handle; /* object reference */ | ||
676 | } reference; | ||
677 | |||
678 | struct { | ||
679 | acpi_object_type type; /* ACPI_TYPE_PROCESSOR */ | ||
675 | u32 proc_id; | 680 | u32 proc_id; |
676 | acpi_io_address pblk_address; | 681 | acpi_io_address pblk_address; |
677 | u32 pblk_length; | 682 | u32 pblk_length; |
678 | } processor; | 683 | } processor; |
679 | 684 | ||
680 | struct { | 685 | struct { |
681 | acpi_object_type type; | 686 | acpi_object_type type; /* ACPI_TYPE_POWER */ |
682 | u32 system_level; | 687 | u32 system_level; |
683 | u32 resource_order; | 688 | u32 resource_order; |
684 | } power_resource; | 689 | } power_resource; |