diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 997b6cb20cf079b41f3a89332906950dd3f5f6b5..10a02822ef56fa5a0a8daaf6272fd8340ebd218a 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -38,6 +38,7 @@ #include <acpi/acpi.h> #include <asm/io.h> #include <acpi/acpi_bus.h> +#include <asm/uaccess.h> #ifdef CONFIG_ACPI_EFI #include <linux/efi.h> @@ -948,19 +949,22 @@ acpi_os_get_line(char *buffer) return 0; } -/* - * We just have to assume we're dealing with valid memory - */ - +/* Assumes no unreadable holes inbetween */ BOOLEAN acpi_os_readable(void *ptr, u32 len) { +#if defined(__i386__) || defined(__x86_64__) + char tmp; + return !__get_user(tmp, (char *)ptr) && !__get_user(tmp, (char *)ptr + len - 1); +#endif return 1; } BOOLEAN acpi_os_writable(void *ptr, u32 len) { + /* could do dummy write (racy) or a kernel page table lookup. + The later may be difficult at early boot when kmap doesn't work yet. */ return 1; }