Fix oops in sony-laptop setup (rhbz 873107)

This commit is contained in:
Josh Boyer 2012-12-17 09:04:27 -05:00
parent 878f7ae56d
commit 0aeca8efc1
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

@ -62,7 +62,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 5
%global baserelease 6
%global fedora_build %{baserelease}
# base_sublevel is the kernel version we're starting with and patching
@ -773,6 +773,9 @@ Patch21233: 8139cp-re-enable-interrupts-after-tx-timeout.patch
#rhbz 883414
Patch21236: 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
@ -1488,6 +1491,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
@ -2348,6 +2354,9 @@ fi
# ||----w |
# || ||
%changelog
* Mon Dec 17 2012 Josh Boyer <jwboyer@redhat.com>
- Fix oops in sony-laptop setup (rhbz 873107)
* Fri Dec 14 2012 Peter Robinson <pbrobinson@fedoraproject.org>
- Add patch to fix arm imx drm driver build