summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2015-06-23 04:11:19 -0400
committerDarren Hart <dvhart@linux.intel.com>2015-06-24 23:22:02 -0400
commitb8830a4e71b15d0364ac8e6c55301eea73f211da (patch)
tree606cb40e27418e25a19e99c01bbee1361e213fb3 /drivers/platform
parent2e19f93fecc502e68131e4433ef8d57ffa22bc3b (diff)
dell-laptop: Fix allocating & freeing SMI buffer page
This commit fix kernel crash when probing for rfkill devices in dell-laptop driver failed. Function free_page() was incorrectly used on struct page * instead of virtual address of SMI buffer. This commit also simplify allocating page for SMI buffer by using __get_free_page() function instead of sequential call of functions alloc_page() and page_address(). Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: stable@vger.kernel.org Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/dell-laptop.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 9724613c28a6..35758cbc6bc8 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -306,7 +306,6 @@ static const struct dmi_system_id dell_quirks[] __initconst = {
306}; 306};
307 307
308static struct calling_interface_buffer *buffer; 308static struct calling_interface_buffer *buffer;
309static struct page *bufferpage;
310static DEFINE_MUTEX(buffer_mutex); 309static DEFINE_MUTEX(buffer_mutex);
311 310
312static int hwswitch_state; 311static int hwswitch_state;
@@ -2068,12 +2067,11 @@ static int __init dell_init(void)
2068 * Allocate buffer below 4GB for SMI data--only 32-bit physical addr 2067 * Allocate buffer below 4GB for SMI data--only 32-bit physical addr
2069 * is passed to SMI handler. 2068 * is passed to SMI handler.
2070 */ 2069 */
2071 bufferpage = alloc_page(GFP_KERNEL | GFP_DMA32); 2070 buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
2072 if (!bufferpage) { 2071 if (!buffer) {
2073 ret = -ENOMEM; 2072 ret = -ENOMEM;
2074 goto fail_buffer; 2073 goto fail_buffer;
2075 } 2074 }
2076 buffer = page_address(bufferpage);
2077 2075
2078 ret = dell_setup_rfkill(); 2076 ret = dell_setup_rfkill();
2079 2077
@@ -2135,7 +2133,7 @@ static int __init dell_init(void)
2135fail_backlight: 2133fail_backlight:
2136 dell_cleanup_rfkill(); 2134 dell_cleanup_rfkill();
2137fail_rfkill: 2135fail_rfkill:
2138 free_page((unsigned long)bufferpage); 2136 free_page((unsigned long)buffer);
2139fail_buffer: 2137fail_buffer:
2140 platform_device_del(platform_device); 2138 platform_device_del(platform_device);
2141fail_platform_device2: 2139fail_platform_device2: