The patch titled rlimit-permit-setting-rlimit_nofile-to-rlim_infinity-fix has been added to the -mm tree. Its filename is rlimit-permit-setting-rlimit_nofile-to-rlim_infinity-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: rlimit-permit-setting-rlimit_nofile-to-rlim_infinity-fix From: Adam Tkac <vonsch@xxxxxxxxx> When cur > max && cur != INF after adjustment EINVAL is returned. (cur can be also set to max but it seems like bad solution for me) Cc: Andreas Schwab <schwab@xxxxxxx> Cc: Michael Kerrisk <mtk.manpages@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/sys.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN kernel/sys.c~rlimit-permit-setting-rlimit_nofile-to-rlim_infinity-fix kernel/sys.c --- a/kernel/sys.c~rlimit-permit-setting-rlimit_nofile-to-rlim_infinity-fix +++ a/kernel/sys.c @@ -1526,12 +1526,11 @@ asmlinkage long sys_setrlimit(unsigned i return -EINVAL; if (copy_from_user(&new_rlim, rlim, sizeof(*rlim))) return -EFAULT; - if (new_rlim.rlim_cur > new_rlim.rlim_max) - return -EINVAL; old_rlim = current->signal->rlim + resource; if ((new_rlim.rlim_max > old_rlim->rlim_max) && !capable(CAP_SYS_RESOURCE)) return -EPERM; + if (resource == RLIMIT_NOFILE) { if (new_rlim.rlim_max == RLIM_INFINITY) new_rlim.rlim_max = sysctl_nr_open; @@ -1541,6 +1540,9 @@ asmlinkage long sys_setrlimit(unsigned i return -EPERM; } + if (new_rlim.rlim_cur > new_rlim.rlim_max) + return -EINVAL; + retval = security_task_setrlimit(resource, &new_rlim); if (retval) return retval; _ Patches currently in -mm which might be from vonsch@xxxxxxxxx are rlimit-permit-setting-rlimit_nofile-to-rlim_infinity.patch rlimit-permit-setting-rlimit_nofile-to-rlim_infinity-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html