Fix oops in sony-laptop setup (rhbz 873107)

This commit is contained in:
Josh Boyer 2012-12-17 09:04:27 -05:00
parent 551dcfff50
commit 87db8bc3ed
2 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 690b1ad9d2032d6f2565d44f6564590d47835ae8 Mon Sep 17 00:00:00 2001
From: Zhang Rui <rui.zhang@intel.com>
Date: Thu, 29 Nov 2012 01:30:43 +0800
Subject: [PATCH 1/2] ACPI sony-laptop: do proper memcpy for ACPI_TYPE_INTEGER
acpi_object
the return value of __call_snc_method can either be
an ACPI_TYPE_BUFFER object or a ACPI_TYPE_INTEGER object.
do proper memcpy for ACPI_TYPE_INTEGER object.
https://bugzilla.kernel.org/show_bug.cgi?id=50111
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/platform/x86/sony-laptop.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index daaddec..92e0da2 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -792,20 +792,19 @@ static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
if (!object)
return -EINVAL;
- if (object->type == ACPI_TYPE_BUFFER)
+ if (object->type == ACPI_TYPE_BUFFER) {
len = MIN(buflen, object->buffer.length);
-
- else if (object->type == ACPI_TYPE_INTEGER)
+ memcpy(buffer, object->buffer.pointer, len);
+ } else if (object->type == ACPI_TYPE_INTEGER) {
len = MIN(buflen, sizeof(object->integer.value));
-
- else {
+ memcpy(buffer, (void *)&object->integer.value, len);
+ } else {
pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n",
ACPI_TYPE_BUFFER, object->type);
kfree(object);
return -EINVAL;
}
- memcpy(buffer, object->buffer.pointer, len);
kfree(object);
return 0;
}
--
1.7.9.5

View File

@ -54,7 +54,7 @@ Summary: The Linux kernel
# For non-released -rc kernels, this will be appended after the rcX and
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
#
%global baserelease 2
%global baserelease 3
%global fedora_build %{baserelease}
# base_sublevel is the kernel version we're starting with and patching
@ -729,6 +729,9 @@ Patch21233: 8139cp-re-enable-interrupts-after-tx-timeout.patch
#rhbz 883414
Patch21234: mac80211-fix-ibss-scanning.patch
#rhbz 873107
Patch21237: 0001-ACPI-sony-laptop-do-proper-memcpy-for-ACPI_TYPE_INTE.patch
# END OF PATCH DEFINITIONS
%endif
@ -1375,6 +1378,9 @@ ApplyPatch 8139cp-re-enable-interrupts-after-tx-timeout.patch
#rhbz 883414
ApplyPatch mac80211-fix-ibss-scanning.patch
#rhbz 873107
ApplyPatch 0001-ACPI-sony-laptop-do-proper-memcpy-for-ACPI_TYPE_INTE.patch
# END OF PATCH APPLICATIONS
@ -2076,6 +2082,9 @@ fi
# and build.
%changelog
* Mon Dec 17 2012 Josh Boyer <jwboyer@redhat.com>
- Fix oops in sony-laptop setup (rhbz 873107)
* Tue Dec 11 2012 Josh Boyer <jwboyer@redhat.com>
- Fix IBSS scanning in mac80211 (rhbz 883414)