Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56883
b: refs/heads/master
c: 6087b2d
h: refs/heads/master
i:
  56881: b8dfa56
  56879: e98c5e8
v: v3
  • Loading branch information
Badari Pulavarty authored and Linus Torvalds committed May 24, 2007
1 parent 3c9209a commit 225253b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7bb44adef39ad3bda2be40bb34686bc56bd563a5
refs/heads/master: 6087b2dab2c914268b1a50882edbbad82bfefd29
17 changes: 11 additions & 6 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1544,9 +1544,10 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
compat_ulong_t __user *outp, compat_ulong_t __user *exp, s64 *timeout)
{
fd_set_bits fds;
char *bits;
void *bits;
int size, max_fds, ret = -EINVAL;
struct fdtable *fdt;
long stack_fds[SELECT_STACK_ALLOC/sizeof(long)];

if (n < 0)
goto out_nofds;
Expand All @@ -1564,11 +1565,14 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
* since we used fdset we need to allocate memory in units of
* long-words.
*/
ret = -ENOMEM;
size = FDS_BYTES(n);
bits = kmalloc(6 * size, GFP_KERNEL);
if (!bits)
goto out_nofds;
bits = stack_fds;
if (size > sizeof(stack_fds) / 6) {
bits = kmalloc(6 * size, GFP_KERNEL);
ret = -ENOMEM;
if (!bits)
goto out_nofds;
}
fds.in = (unsigned long *) bits;
fds.out = (unsigned long *) (bits + size);
fds.ex = (unsigned long *) (bits + 2*size);
Expand Down Expand Up @@ -1600,7 +1604,8 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
compat_set_fd_set(n, exp, fds.res_ex))
ret = -EFAULT;
out:
kfree(bits);
if (bits != stack_fds)
kfree(bits);
out_nofds:
return ret;
}
Expand Down

0 comments on commit 225253b

Please sign in to comment.