Commit 657732b7 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: fix sys32_select race with max_fdset

parent 1ed3b323
...@@ -238,8 +238,6 @@ asmlinkage long sys32_writev(u32 fd, struct iovec32 *vector, u32 count) ...@@ -238,8 +238,6 @@ asmlinkage long sys32_writev(u32 fd, struct iovec32 *vector, u32 count)
return ret; return ret;
} }
static inline int get_flock(struct flock *kfl, struct flock32 *ufl) static inline int get_flock(struct flock *kfl, struct flock32 *ufl)
{ {
int err; int err;
...@@ -656,7 +654,7 @@ asmlinkage long sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x) ...@@ -656,7 +654,7 @@ asmlinkage long sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x)
char *bits; char *bits;
unsigned long nn; unsigned long nn;
long timeout; long timeout;
int ret, size; int ret, size, max_fdset;
timeout = MAX_SCHEDULE_TIMEOUT; timeout = MAX_SCHEDULE_TIMEOUT;
if (tvp) { if (tvp) {
...@@ -679,8 +677,11 @@ asmlinkage long sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x) ...@@ -679,8 +677,11 @@ asmlinkage long sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x)
ret = -EINVAL; ret = -EINVAL;
if (n < 0) if (n < 0)
goto out_nofds; goto out_nofds;
if (n > current->files->max_fdset)
n = current->files->max_fdset; /* max_fdset can increase, so grab it once to avoid race */
max_fdset = current->files->max_fdset;
if (n > max_fdset)
n = max_fdset;
/* /*
* We need 6 bitmaps (in/out/ex for both incoming and outgoing), * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
......
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