]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI: Fix memory leak in acpi_bind_one()
authorJesper Juhl <jj@chaosbits.net>
Mon, 22 Oct 2012 22:53:58 +0000 (00:53 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 22 Oct 2012 22:53:58 +0000 (00:53 +0200)
commita81ff3e6839fc1ab99d06b681546d85727079dd3
treecc17169af9d7c96976b274afb74bd7602aba5074
parent6ab66186695d33c81b559545154047cd3436b033
ACPI: Fix memory leak in acpi_bind_one()

Memory is allocated with kzalloc() and assigned to
'physical_node'. Then 'physical_node->node_id' is initialized with a
call to 'find_first_zero_bit()', if that results in a value greater
than ACPI_MAX_PHYSICAL_NODE we'll end up jumping to the 'err:' label
and there leave the function and let 'physical_node' go out of scope
and leak the memory we allocated.
This patch fixes the leak by simply freeing the unused/unneeded memory
pointed to by 'physical_node' just before we jump to 'err:'.

[rjw: The problem has been introduced by commit 258edae (ACPI: Allow
 ACPI binding with USB-3.0 hub), which is new in 3.7-rc.]

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/glue.c