ACPI / utils: Fix memory leak in acpi_evaluate_reference() error path
authorXiongfeng Wang <wangxiongfeng2@huawei.com>
Thu, 9 Nov 2017 06:22:39 +0000 (14:22 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 14 Nov 2017 11:54:55 +0000 (12:54 +0100)
When package.count is larger than ACPI_MAX_HANDLES, buffer.pointer is
not freed before the function returns AE_NO_MEMORY. Fix this possible
memory leak by kfree'ing it.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/utils.c

index 0a9e597..9d49a1a 100644 (file)
@@ -355,6 +355,7 @@ acpi_evaluate_reference(acpi_handle handle,
        }
 
        if (package->package.count > ACPI_MAX_HANDLES) {
+               kfree(package);
                return AE_NO_MEMORY;
        }
        list->count = package->package.count;