Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573596

RE: [PATCH] acpica: Fix double-free in acpi_ns_repair_CID()

From "Moore, Robert" <robert.moore@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH] acpica: Fix double-free in acpi_ns_repair_CID()
Date 2017-02-04 05:20 +0100
Message-ID <t6ZZp-3wQ-15@gated-at.bofh.it> (permalink)
References <t6T7A-6Ri-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Here's the sequence of events as I see it:

Repair_HID is a standalone function that removes one reference on the incoming object. For simple _HID objects, this in fact deletes the object.

For _CID, all elements of the package are examined. If a repair was made on a _HID within the _CID function, one reference on the original object was removed by Repair_HID. However, since the object is part of a package, it has an extra reference to reflect this fact. Thus, in the case in question, the elements of the package all have at least two references. Repair_HID removes one reference, thus the extra RemoveReference is needed in Repair_CID to bring the reference count down to zero actually delete the object (in the typical case where the object had two references).

Bob


> -----Original Message-----
> From: João Paulo Rechi Vita [mailto:jprvita@gmail.com]
> Sent: Friday, February 03, 2017 12:57 PM
> To: Moore, Robert; Zheng, Lv; Wysocki, Rafael J; Len Brown; Lin Ming
> Cc: linux-acpi@vger.kernel.org; devel@acpica.org; linux-
> kernel@vger.kernel.org; Daniel Drake; linux@endlessm.com; João Paulo Rechi
> Vita
> Subject: [PATCH] acpica: Fix double-free in acpi_ns_repair_CID()
> 
> When acpi_ns_repair_CID() is called for a _CID which returns a package of
> strings, it calls acpi_ns_repair_HID() for each of the package elements.
> acpi_ns_repair_HID() calls acpi_ut_remove_reference() on the original
> object, but acpi_ns_repair_CID() calls it again on return, leading to a
> double free.
> 
> This problem was seen on a Acer TravelMate P449-G2-MG.
> 
> Thanks to Daniel Drake for helping investigating this problem.
> 
> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
> ---
>  drivers/acpi/acpica/nsrepair2.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/nsrepair2.c
> b/drivers/acpi/acpica/nsrepair2.c index d5336122486b..c429c8eca476 100644
> --- a/drivers/acpi/acpica/nsrepair2.c
> +++ b/drivers/acpi/acpica/nsrepair2.c
> @@ -411,8 +411,6 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info,
> 
>  			(*element_ptr)->common.reference_count =
>  			    original_ref_count;
> -
> -			acpi_ut_remove_reference(original_element);
>  		}
> 
>  		element_ptr++;
> --
> 2.11.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] acpica: Fix double-free in acpi_ns_repair_CID() "João Paulo Rechi Vita" <jprvita@gmail.com> - 2017-02-03 22:00 +0100
  RE: [PATCH] acpica: Fix double-free in acpi_ns_repair_CID() "Moore, Robert" <robert.moore@intel.com> - 2017-02-04 05:20 +0100
    RE: [PATCH] acpica: Fix double-free in acpi_ns_repair_CID() "Zheng, Lv" <lv.zheng@intel.com> - 2017-02-06 02:50 +0100
      Re: [PATCH] acpica: Fix double-free in acpi_ns_repair_CID() Daniel Drake <drake@endlessm.com> - 2017-02-06 16:10 +0100

csiph-web