Skip to contentSkip to conversation

mm-memory-failure-fix-potential-page-refcnt-leak-in-memory_failure.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Aug 24, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: memory-failure: fix potential page refcnt leak in memory_failure()
has been removed from the -mm tree. Its filename was
mm-memory-failure-fix-potential-page-refcnt-leak-in-memory_failure.patch

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

------------------------------------------------------
From: Miaohe Lin <[email protected]>
Subject: mm: memory-failure: fix potential page refcnt leak in memory_failure()
Date: Sat, 1 Jul 2023 15:28:37 +0800

put_ref_page() is not called to drop extra refcnt when comes from madvise in the case pfn is valid but pgmap is NULL leading to page refcnt leak.

Fixes 1e8aaedb182d ("mm,memory_failure: always pin the page in madvise_inject_error")

---

 mm/memory-failure.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/memory-failure.c renamed from mm/memory-failure.c~mm-memory-failure-fix-potential-page-refcnt-leak-in-memory_failure +1 -2
@@ -2117,8 +2117,6 @@ static int memory_failure_dev_pagemap(un
 {
 	int rc = -ENXIO;
 
-	put_ref_page(pfn, flags);
-
 	/* device metadata space is not recoverable */
 	if (!pgmap_pfn_valid(pgmap, pfn))
 		goto out;
@@ -2193,6 +2191,7 @@ int memory_failure(unsigned long pfn, in
 
 		if (pfn_valid(pfn)) {
 			pgmap = get_dev_pagemap(pfn, NULL);
+			put_ref_page(pfn, flags);
 			if (pgmap) {
 				res = memory_failure_dev_pagemap(pfn, flags,
 								 pgmap);

_

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

mm-memory-failure-add-pageoffline-check.patch