diff options
author | Andrew Morton <akpm@osdl.org> | 2006-12-06 23:36:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:34 -0500 |
commit | 20aa7b21b1cbd1aa3fbf5fc14da5f7484a61a824 (patch) | |
tree | ae0e9ec484c26f29f8f5cfa863a84943c27dfe9d /include/linux/uaccess.h | |
parent | c140e110019f25ffa1c6f3f365b0c9103d0b8475 (diff) |
[PATCH] probe_kernel_address() needs to do set_fs()
probe_kernel_address() purports to be generic, only it forgot to select
KERNEL_DS, so it presently won't work right on all architectures.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/uaccess.h')
-rw-r--r-- | include/linux/uaccess.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 67918c22339c..76c3fe325101 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
@@ -65,14 +65,22 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
65 | * do_page_fault() doesn't attempt to take mmap_sem. This makes | 65 | * do_page_fault() doesn't attempt to take mmap_sem. This makes |
66 | * probe_kernel_address() suitable for use within regions where the caller | 66 | * probe_kernel_address() suitable for use within regions where the caller |
67 | * already holds mmap_sem, or other locks which nest inside mmap_sem. | 67 | * already holds mmap_sem, or other locks which nest inside mmap_sem. |
68 | * This must be a macro because __get_user() needs to know the types of the | ||
69 | * args. | ||
70 | * | ||
71 | * We don't include enough header files to be able to do the set_fs(). We | ||
72 | * require that the probe_kernel_address() caller will do that. | ||
68 | */ | 73 | */ |
69 | #define probe_kernel_address(addr, retval) \ | 74 | #define probe_kernel_address(addr, retval) \ |
70 | ({ \ | 75 | ({ \ |
71 | long ret; \ | 76 | long ret; \ |
77 | mm_segment_t old_fs = get_fs(); \ | ||
72 | \ | 78 | \ |
79 | set_fs(KERNEL_DS); \ | ||
73 | pagefault_disable(); \ | 80 | pagefault_disable(); \ |
74 | ret = __get_user(retval, addr); \ | 81 | ret = __get_user(retval, addr); \ |
75 | pagefault_enable(); \ | 82 | pagefault_enable(); \ |
83 | set_fs(old_fs); \ | ||
76 | ret; \ | 84 | ret; \ |
77 | }) | 85 | }) |
78 | 86 | ||