Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vm: fix incorrect unlock error path in madvise_free_huge_pmd

Commit b8d3c4c3009d ("mm/huge_memory.c: don't split THP page when
MADV_FREE syscall is called") introduced this new function, but got the
error handling for when pmd_trans_huge_lock() fails wrong. In the
failure case, the lock has not been taken, and we should not unlock on
the way out.

Cc: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+1 -1
+1 -1
mm/huge_memory.c
··· 1561 1561 int ret = 0; 1562 1562 1563 1563 if (!pmd_trans_huge_lock(pmd, vma, &ptl)) 1564 - goto out; 1564 + goto out_unlocked; 1565 1565 1566 1566 orig_pmd = *pmd; 1567 1567 if (is_huge_zero_pmd(orig_pmd)) {