The patch titled Subject: mm/mlock: fix potential imbalanced rlimit ucounts adjustment has been removed from the -mm tree. Its filename was mm-mlock-fix-potential-imbalanced-rlimit-ucounts-adjustment.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Miaohe Lin <linmiaohe@xxxxxxxxxx> Subject: mm/mlock: fix potential imbalanced rlimit ucounts adjustment user_shm_lock forgets to set allowed to 0 when get_ucounts fails. So the later user_shm_unlock might do the extra dec_rlimit_ucounts. Fix this by resetting allowed to 0. Link: https://lkml.kernel.org/r/20220310132417.41189-1-linmiaohe@xxxxxxxxxx Fixes: d7c9e99aee48 ("Reimplement RLIMIT_MEMLOCK on top of ucounts") Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Acked-by: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Herbert van den Bergh <herbert.van.den.bergh@xxxxxxxxxx> Cc: Chris Mason <chris.mason@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mlock.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/mlock.c~mm-mlock-fix-potential-imbalanced-rlimit-ucounts-adjustment +++ a/mm/mlock.c @@ -839,6 +839,7 @@ int user_shm_lock(size_t size, struct uc } if (!get_ucounts(ucounts)) { dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_MEMLOCK, locked); + allowed = 0; goto out; } allowed = 1; _ Patches currently in -mm which might be from linmiaohe@xxxxxxxxxx are mm-huge_memory-make-is_transparent_hugepage-static.patch