ACPI / memhotplug: Fix a stale pointer in error path
PATCH 1/1 ACPI / memhotplug: Fix a stale pointer in error path
device->driver_data needs to be cleared when releasing its data, mem_device, in an error path of acpi_memory_device_add().
--- drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpi_memhotplug.c +1 -0
@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; }
Quoted 5 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Signed-off-by Toshi Kani <[email protected]>---
Thanks,
Yasuaki Ishimatsu
Quoted 20 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Yasuaki Ishimatsu
Quoted 5 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>
Thanks Yasuaki!
-Toshi
Quoted 26 lines
Thanks,
Yasuaki IshimatsuQuoted 20 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Toshi Kani
Quoted 8 lines · Yasuaki Ishimatsu
Quoted 5 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Queued up as a fix for 3.11.
Do we need that in -stable as well?
Rafael
Quoted 25 lines
Quoted 23 lines
Quoted 21 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Toshi Kani
Quoted 4 lines · Yasuaki Ishimatsu
Quoted 3 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Queued up as a fix for 3.11.
Thanks!
Quoted 1 line
Do we need that in -stable as well?
Good point. Yes, we need that in -stable as well.
-Toshi
Quoted 28 lines
Rafael
Quoted 25 lines
Quoted 23 lines
Quoted 21 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Toshi Kani
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Toshi Kani
Quoted 8 lines · Yasuaki Ishimatsu
Quoted 5 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Quoted 7 lines
Quoted 1 line
Queued up as a fix for 3.11.
Thanks!
Quoted 1 line
Do we need that in -stable as well?
Good point. Yes, we need that in -stable as well.
What's the oldest mainline major release that fix is applicable to?
Rafael
Quoted 26 lines
Quoted 24 lines
Quoted 24 lines
Quoted 22 lines
Quoted 20 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 17 lines · Rafael J. Wysocki
Quoted 16 lines · Toshi Kani
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Toshi Kani
Quoted 8 lines · Yasuaki Ishimatsu
Quoted 5 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Queued up as a fix for 3.11.
Quoted 7 lines
Quoted 5 lines
Thanks!
Quoted 1 line
Do we need that in -stable as well?
Good point. Yes, we need that in -stable as well.
What's the oldest mainline major release that fix is applicable to?
The fix is applicable all ways up to 2.6.32.
Thanks,
-Toshi
Quoted 30 lines
Rafael
Quoted 26 lines
Quoted 24 lines
Quoted 24 lines
Quoted 22 lines
Quoted 20 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 20 lines · Toshi Kani
Quoted 19 lines · Rafael J. Wysocki
Quoted 18 lines · Toshi Kani
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Toshi Kani
Quoted 4 lines · Yasuaki Ishimatsu
Quoted 3 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Queued up as a fix for 3.11.
Thanks!
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Do we need that in -stable as well?
Good point. Yes, we need that in -stable as well.
What's the oldest mainline major release that fix is applicable to?
The fix is applicable all ways up to 2.6.32.
For -stable I'll need to say some more about what practical consequences of the bug are. Is it difficult to trigger?
Rafael
Quoted 28 lines
Quoted 26 lines
Quoted 26 lines
Quoted 24 lines
Quoted 24 lines
Quoted 22 lines
Quoted 20 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 23 lines · Rafael J. Wysocki
Quoted 22 lines · Toshi Kani
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Toshi Kani
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Toshi Kani
Quoted 4 lines · Yasuaki Ishimatsu
Quoted 3 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Queued up as a fix for 3.11.
Thanks!
Quoted 1 line
Do we need that in -stable as well?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Good point. Yes, we need that in -stable as well.
What's the oldest mainline major release that fix is applicable to?
The fix is applicable all ways up to 2.6.32.
For -stable I'll need to say some more about what practical consequences of the bug are. Is it difficult to trigger?
The function evaluates _CRS of memory device objects, and fails when it gets an unexpected resource or cannot allocate a memory. A kernel crash or data corruption may occur when the kernel accessed a stale pointer. That said, I am not sure how critical this issue is for old kernels since I do not think there are many platforms that support memory hotplug today. After reading the recent -stable discussion on LKML, now I am not sure if this fix should be applied for -stable. I instrumented the kernel to generate an error for testing this change.
Thanks,
-Toshi
Quoted 32 lines
Rafael
Quoted 28 lines
Quoted 26 lines
Quoted 26 lines
Quoted 24 lines
Quoted 24 lines
Quoted 22 lines
Quoted 20 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 28 lines · Toshi Kani
Quoted 27 lines · Rafael J. Wysocki
Quoted 26 lines · Toshi Kani
Quoted 24 lines · Rafael J. Wysocki
Quoted 14 lines · Toshi Kani
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Toshi Kani
Quoted 8 lines · Yasuaki Ishimatsu
Quoted 5 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Quoted 7 lines
Quoted 1 line
Queued up as a fix for 3.11.
Thanks!
Quoted 1 line
Do we need that in -stable as well?
Good point. Yes, we need that in -stable as well.
What's the oldest mainline major release that fix is applicable to?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
The fix is applicable all ways up to 2.6.32.
For -stable I'll need to say some more about what practical consequences of the bug are. Is it difficult to trigger?
The function evaluates
_CRSof memory device objects, and fails when it gets an unexpected resource or cannot allocate a memory.
OK, so this is essentially about surviving unexpected external input, which I suppose is serious enough.
Quoted 5 lines
A kernel crash
or data corruption may occur when the kernel accessed a stale pointer. That said, I am not sure how critical this issue is for old kernels since I do not think there are many platforms that support memory hotplug today.
Which doesn't matter. People may want to run 3.10.y on future hardware too.
Quoted 2 lines
After reading the recent -stable discussion on LKML, now I am not sure if this fix should be applied for -stable.
Well, I don't necessarily agree with some things being said there. I guess I'll need to say something in that thread. :-)
Quoted 1 line
I instrumented the kernel to generate an error for testing this change.
OK
Thanks,
Rafael
Quoted 34 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/acpi_memhotplug.c +1
-1@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,/* Get the range from the _CRS */ result =acpi_memory_get_device_resources (mem_device);if (result) { + device->driver_data =NULL ;kfree (mem_device);return result; } --To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 40 lines · Rafael J. Wysocki
Quoted 28 lines · Toshi Kani
Quoted 27 lines · Rafael J. Wysocki
Quoted 26 lines · Toshi Kani
Quoted 24 lines · Rafael J. Wysocki
Quoted 14 lines · Toshi Kani
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Toshi Kani
Quoted 8 lines · Yasuaki Ishimatsu
Quoted 5 lines · Toshi Kani
device->driver_dataneeds to be cleared when releasing its data,mem_device, in an error path ofacpi_memory_device_add().Signed-off-by Toshi Kani <[email protected]>---
Reviewed-by Yasuaki Ishimatsu <[email protected]>Thanks Yasuaki!
Quoted 7 lines
Quoted 1 line
Queued up as a fix for 3.11.
Thanks!
Quoted 1 line
Do we need that in -stable as well?
Good point. Yes, we need that in -stable as well.
What's the oldest mainline major release that fix is applicable to?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
The fix is applicable all ways up to 2.6.32.
For -stable I'll need to say some more about what practical consequences of the bug are. Is it difficult to trigger?
The function evaluates
_CRSof memory device objects, and fails when it gets an unexpected resource or cannot allocate a memory.OK, so this is essentially about surviving unexpected external input, which I suppose is serious enough.
Quoted 7 lines
Quoted 5 lines
A kernel crash
or data corruption may occur when the kernel accessed a stale pointer. That said, I am not sure how critical this issue is for old kernels since I do not think there are many platforms that support memory hotplug today.Which doesn't matter. People may want to run 3.10.y on future hardware too.
Good point. Thanks for the clarification!
-Toshi