mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-15 11:44:11 +00:00
ucounts: Handle wrapping in is_ucounts_overlimit
commit0cbae9e24f
upstream. While examining is_ucounts_overlimit and reading the various messages I realized that is_ucounts_overlimit fails to deal with counts that may have wrapped. Being wrapped should be a transitory state for counts and they should never be wrapped for long, but it can happen so handle it. Cc: stable@vger.kernel.org Fixes:21d1c5e386
("Reimplement RLIMIT_NPROC on top of ucounts") Link: https://lkml.kernel.org/r/20220216155832.680775-5-ebiederm@xmission.com Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9dd7fd8019
commit
6f924d0160
1 changed files with 2 additions and 1 deletions
|
@ -344,7 +344,8 @@ bool is_ucounts_overlimit(struct ucounts *ucounts, enum ucount_type type, unsign
|
|||
if (rlimit > LONG_MAX)
|
||||
max = LONG_MAX;
|
||||
for (iter = ucounts; iter; iter = iter->ns->ucounts) {
|
||||
if (get_ucounts_value(iter, type) > max)
|
||||
long val = get_ucounts_value(iter, type);
|
||||
if (val < 0 || val > max)
|
||||
return true;
|
||||
max = READ_ONCE(iter->ns->ucount_max[type]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue