]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.56/acpi-memhotplug-fix-a-stale-pointer-in-error-path.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.56 / acpi-memhotplug-fix-a-stale-pointer-in-error-path.patch
1 From d19f503e22316a84c39bc19445e0e4fdd49b3532 Mon Sep 17 00:00:00 2001
2 From: Toshi Kani <toshi.kani@hp.com>
3 Date: Wed, 10 Jul 2013 10:47:13 -0600
4 Subject: ACPI / memhotplug: Fix a stale pointer in error path
5
6 From: Toshi Kani <toshi.kani@hp.com>
7
8 commit d19f503e22316a84c39bc19445e0e4fdd49b3532 upstream.
9
10 device->driver_data needs to be cleared when releasing its data,
11 mem_device, in an error path of acpi_memory_device_add().
12
13 The function evaluates the _CRS of memory device objects, and fails
14 when it gets an unexpected resource or cannot allocate memory. A
15 kernel crash or data corruption may occur when the kernel accesses
16 the stale pointer.
17
18 Signed-off-by: Toshi Kani <toshi.kani@hp.com>
19 Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
20 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23 ---
24 drivers/acpi/acpi_memhotplug.c | 1 +
25 1 file changed, 1 insertion(+)
26
27 --- a/drivers/acpi/acpi_memhotplug.c
28 +++ b/drivers/acpi/acpi_memhotplug.c
29 @@ -421,6 +421,7 @@ static int acpi_memory_device_add(struct
30 /* Get the range from the _CRS */
31 result = acpi_memory_get_device_resources(mem_device);
32 if (result) {
33 + device->driver_data = NULL;
34 kfree(mem_device);
35 return result;
36 }