diff mbox series

ACPICA: Disassembler: Fix missing decrement reference when attach operand_object failed

Message ID 20221125031120.3946901-1-bobo.shaobowang@huawei.com (mailing list archive)
State Not Applicable, archived
Headers show
Series ACPICA: Disassembler: Fix missing decrement reference when attach operand_object failed | expand

Commit Message

Wangshaobo (bobo) Nov. 25, 2022, 3:11 a.m. UTC
The acpi_operand_object object's reference count has not been decremented
if attached to associated value failed, so may cause this object cannot be
released forever, this add acpi_ut_remove_reference() to handle reference
decrement.

Fixes: 6ccd7b5acc41 ("ACPICA: Disassembler: Add support for Operation Region externals")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
 drivers/acpi/acpica/dsfield.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Rafael J. Wysocki Nov. 25, 2022, 10:47 a.m. UTC | #1
On Fri, Nov 25, 2022 at 4:13 AM Wang ShaoBo <bobo.shaobowang@huawei.com> wrote:
>
> The acpi_operand_object object's reference count has not been decremented
> if attached to associated value failed, so may cause this object cannot be
> released forever, this add acpi_ut_remove_reference() to handle reference
> decrement.
>
> Fixes: 6ccd7b5acc41 ("ACPICA: Disassembler: Add support for Operation Region externals")
> Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>

Please submit ACPICA changes to the upstream project on GitHub.

Thanks!

> ---
>  drivers/acpi/acpica/dsfield.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
> index de175f1b4beb..3a3d3ab3e2c3 100644
> --- a/drivers/acpi/acpica/dsfield.c
> +++ b/drivers/acpi/acpica/dsfield.c
> @@ -93,6 +93,9 @@ acpi_ds_create_external_region(acpi_status lookup_status,
>
>         obj_desc->region.node = *node;
>         status = acpi_ns_attach_object(*node, obj_desc, ACPI_TYPE_REGION);
> +       if (ACPI_FAILURE(status))
> +               acpi_ut_remove_reference(obj_desc);
> +
>         return (status);
>  }
>  #endif
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index de175f1b4beb..3a3d3ab3e2c3 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -93,6 +93,9 @@  acpi_ds_create_external_region(acpi_status lookup_status,
 
 	obj_desc->region.node = *node;
 	status = acpi_ns_attach_object(*node, obj_desc, ACPI_TYPE_REGION);
+	if (ACPI_FAILURE(status))
+		acpi_ut_remove_reference(obj_desc);
+
 	return (status);
 }
 #endif