Commit 59cff390 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] copy_to_user checking in select.c

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f6ed4dc9
...@@ -373,9 +373,10 @@ sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, s ...@@ -373,9 +373,10 @@ sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, s
ret = 0; ret = 0;
} }
set_fd_set(n, inp, fds.res_in); if (set_fd_set(n, inp, fds.res_in) ||
set_fd_set(n, outp, fds.res_out); set_fd_set(n, outp, fds.res_out) ||
set_fd_set(n, exp, fds.res_ex); set_fd_set(n, exp, fds.res_ex))
ret = -EFAULT;
out: out:
select_bits_free(bits, size); select_bits_free(bits, size);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/compiler.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -81,11 +82,12 @@ int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset) ...@@ -81,11 +82,12 @@ int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
return 0; return 0;
} }
static inline static inline unsigned long __must_check
void set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset) set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
{ {
if (ufdset) if (ufdset)
__copy_to_user(ufdset, fdset, FDS_BYTES(nr)); return __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
return 0;
} }
static inline static inline
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment