+ selftests-mm-mkdirty-fix-memory-leak-in-test_uffdio_copy.patch added to mm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: selftests/mm/mkdirty: fix memory leak in test_uffdio_copy()
has been added to the -mm mm-unstable branch.  Its filename is
     selftests-mm-mkdirty-fix-memory-leak-in-test_uffdio_copy.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-mm-mkdirty-fix-memory-leak-in-test_uffdio_copy.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: liuye <liuye@xxxxxxxxxx>
Subject: selftests/mm/mkdirty: fix memory leak in test_uffdio_copy()
Date: Tue, 14 Jan 2025 10:38:38 +0800

Release memory before exception branch returns to prevent memory leaks

Checking tools/testing/selftests/mm/mkdirty.c ...
tools/testing/selftests/mm/mkdirty.c:283:3: error: Memory leak: src [memleak]
  return;
  ^

Link: https://lkml.kernel.org/r/20250114023838.48589-1-liuye@xxxxxxxxxx
Signed-off-by: liuye <liuye@xxxxxxxxxx>
Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 tools/testing/selftests/mm/mkdirty.c |    1 +
 1 file changed, 1 insertion(+)

--- a/tools/testing/selftests/mm/mkdirty.c~selftests-mm-mkdirty-fix-memory-leak-in-test_uffdio_copy
+++ a/tools/testing/selftests/mm/mkdirty.c
@@ -280,6 +280,7 @@ static void test_uffdio_copy(void)
 	dst = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE|MAP_ANON, -1, 0);
 	if (dst == MAP_FAILED) {
 		ksft_test_result_fail("mmap() failed\n");
+		free(src);
 		return;
 	}
 
_

Patches currently in -mm which might be from liuye@xxxxxxxxxx are

mm-vmscan-fix-hard-lockup-in-function-isolate_lru_folios.patch
selftests-memfd-memfd_test-fix-possible-null-pointer-dereference.patch
selftests-mm-mkdirty-fix-memory-leak-in-test_uffdio_copy.patch





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux