mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
ACPICA: fix leak of acpi_os_validate_address
http://bugzilla.kernel.org/show_bug.cgi?id=13620 If the dynamic region is created and added to resource list over and over again, it has the potential to be a memory leak by growing the list every time. This patch fixes the memory leak, as below 1) add a new field "count" to struct acpi_res_list. When inserting, if the region(addr, len) is already in the resource list, we just increase "count", otherwise, the region is inserted with count=1. When deleting, the "count" is decreased, if it's decreased to 0, the region is deleted from the resource list. With "count", the region with same address and length can only be inserted to the resource list once, so prevent potential memory leak. 2) add a new function acpi_os_invalidate_address, which is called when region is deleted. Signed-off-by: Lin Ming <[email protected]> Signed-off-by: Len Brown <[email protected]>
This commit is contained in:
parent
422bef879e
commit
a5fe1a03f7
3 changed files with 100 additions and 3 deletions
|
|
@ -245,6 +245,9 @@ acpi_status acpi_osi_invalidate(char* interface);
|
|||
acpi_status
|
||||
acpi_os_validate_address(u8 space_id, acpi_physical_address address,
|
||||
acpi_size length, char *name);
|
||||
acpi_status
|
||||
acpi_os_invalidate_address(u8 space_id, acpi_physical_address address,
|
||||
acpi_size length);
|
||||
|
||||
u64 acpi_os_get_timer(void);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue