Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207831
b: refs/heads/master
c: b951834
h: refs/heads/master
i:
  207829: 7b724c2
  207827: de0ee70
  207823: ca73d45
v: v3
  • Loading branch information
Jiri Slaby committed Jul 16, 2010
1 parent e791450 commit 759da81
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 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: 5b41535aac0c07135ff6a4c5c2ae115d1c20c0bc
refs/heads/master: b95183453af2ed14a5c7027e58049c9fd17e92ce
17 changes: 3 additions & 14 deletions trunk/kernel/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
struct compat_rlimit __user *rlim)
{
struct rlimit r;
int ret;
mm_segment_t old_fs = get_fs ();

if (resource >= RLIM_NLIMITS)
return -EINVAL;

if (!access_ok(VERIFY_READ, rlim, sizeof(*rlim)) ||
__get_user(r.rlim_cur, &rlim->rlim_cur) ||
Expand All @@ -294,10 +289,7 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
r.rlim_cur = RLIM_INFINITY;
if (r.rlim_max == COMPAT_RLIM_INFINITY)
r.rlim_max = RLIM_INFINITY;
set_fs(KERNEL_DS);
ret = sys_setrlimit(resource, (struct rlimit __user *) &r);
set_fs(old_fs);
return ret;
return do_prlimit(current, resource, &r, NULL);
}

#ifdef COMPAT_RLIM_OLD_INFINITY
Expand Down Expand Up @@ -329,16 +321,13 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource,

#endif

asmlinkage long compat_sys_getrlimit (unsigned int resource,
asmlinkage long compat_sys_getrlimit(unsigned int resource,
struct compat_rlimit __user *rlim)
{
struct rlimit r;
int ret;
mm_segment_t old_fs = get_fs();

set_fs(KERNEL_DS);
ret = sys_getrlimit(resource, (struct rlimit __user *) &r);
set_fs(old_fs);
ret = do_prlimit(current, resource, NULL, &r);
if (!ret) {
if (r.rlim_cur > COMPAT_RLIM_INFINITY)
r.rlim_cur = COMPAT_RLIM_INFINITY;
Expand Down
17 changes: 8 additions & 9 deletions trunk/kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,15 +1236,14 @@ SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)

SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
{
if (resource >= RLIM_NLIMITS)
return -EINVAL;
else {
struct rlimit value;
task_lock(current->group_leader);
value = current->signal->rlim[resource];
task_unlock(current->group_leader);
return copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0;
}
struct rlimit value;
int ret;

ret = do_prlimit(current, resource, NULL, &value);
if (!ret)
ret = copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0;

return ret;
}

#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
Expand Down

0 comments on commit 759da81

Please sign in to comment.