Skip to contentSkip to conversation

ucounts-fix-counter-leak-in-inc_rlimit_get_ucounts.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Nov 7, 2024 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: ucounts: fix counter leak in inc_rlimit_get_ucounts()
has been removed from the -mm tree. Its filename was
ucounts-fix-counter-leak-in-inc_rlimit_get_ucounts.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Andrei Vagin <[email protected]>
Subject: ucounts: fix counter leak in inc_rlimit_get_ucounts()
Date: Fri, 1 Nov 2024 19:19:40 +0000

The inc_rlimit_get_ucounts() increments the specified rlimit counter and then checks its limit. If the value exceeds the limit, the function returns an error without decrementing the counter.

Fixes 15bc01effefe ("ucounts: Fix signal ucount refcounting")
Cc Kees Cook <[email protected]>
Cc Andrei Vagin <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Alexey Gladkov <[email protected]>
Cc Oleg Nesterov <[email protected]>

---

 kernel/ucount.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/ucount.c renamed from kernel/ucount.c~ucounts-fix-counter-leak-in-inc_rlimit_get_ucounts +1 -2
@@ -317,7 +317,7 @@ long inc_rlimit_get_ucounts(struct ucoun
 	for (iter = ucounts; iter; iter = iter->ns->ucounts) {
 		long new = atomic_long_add_return(1, &iter->rlimit[type]);
 		if (new < 0 || new > max)
-			goto unwind;
+			goto dec_unwind;
 		if (iter == ucounts)
 			ret = new;
 		max = get_userns_rlimit_max(iter->ns, type);
@@ -334,7 +334,6 @@ long inc_rlimit_get_ucounts(struct ucoun
 dec_unwind:
 	dec = atomic_long_sub_return(1, &iter->rlimit[type]);
 	WARN_ON_ONCE(dec < 0);
-unwind:
 	do_dec_rlimit_put_ucounts(ucounts, iter, type);
 	return 0;
 }

_

Patches currently in -mm which might be from [email protected] are