Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207828
b: refs/heads/master
c: 86f162f
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Jiri Slaby committed Jul 16, 2010
1 parent de0ee70 commit f79e14b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 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: 1c1e618ddd15f69fd87ccea596769f78c8065504
refs/heads/master: 86f162f4c75ceb6daf43165469eeeca1bc3d4639
20 changes: 10 additions & 10 deletions trunk/kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ int do_setrlimit(struct task_struct *tsk, unsigned int resource,
struct rlimit *new_rlim)
{
struct rlimit *old_rlim;
int retval;
int retval = 0;

if (resource >= RLIM_NLIMITS)
return -EINVAL;
Expand All @@ -1293,9 +1293,14 @@ int do_setrlimit(struct task_struct *tsk, unsigned int resource,
goto out;
}

retval = security_task_setrlimit(tsk->group_leader, resource, new_rlim);
if (retval)
goto out;
old_rlim = tsk->signal->rlim + resource;
task_lock(tsk->group_leader);
if (new_rlim->rlim_max > old_rlim->rlim_max &&
!capable(CAP_SYS_RESOURCE))
retval = -EPERM;
if (!retval)
retval = security_task_setrlimit(tsk->group_leader, resource,
new_rlim);

if (resource == RLIMIT_CPU && new_rlim->rlim_cur == 0) {
/*
Expand All @@ -1307,12 +1312,7 @@ int do_setrlimit(struct task_struct *tsk, unsigned int resource,
new_rlim->rlim_cur = 1;
}

old_rlim = tsk->signal->rlim + resource;
task_lock(tsk->group_leader);
if (new_rlim->rlim_max > old_rlim->rlim_max &&
!capable(CAP_SYS_RESOURCE))
retval = -EPERM;
else
if (!retval)
*old_rlim = *new_rlim;
task_unlock(tsk->group_leader);

Expand Down

0 comments on commit f79e14b

Please sign in to comment.