Skip to content

Commit 25eedab

Browse files
committed
vm: fix incorrect unlock error path in madvise_free_huge_pmd
Commit b8d3c4c ("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 parent c671e1e commit 25eedab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/huge_memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ int madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
15611561
int ret = 0;
15621562

15631563
if (!pmd_trans_huge_lock(pmd, vma, &ptl))
1564-
goto out;
1564+
goto out_unlocked;
15651565

15661566
orig_pmd = *pmd;
15671567
if (is_huge_zero_pmd(orig_pmd)) {

0 commit comments

Comments
 (0)