[SRU][J/I/H/F][PATCH 1/1] Revert "UBUNTU: SAUCE: cachefiles: Page leaking in cachefiles_read_backing_file while vmscan is active"

Andrea Righi andrea.righi at canonical.com
Tue Oct 19 10:33:08 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1947709

The following upstream commit is already fixing the page leaking:

9a24ce5b66f9 ("cachefiles: Fix page leak in cachefiles_read_backing_file while vmscan is active")

This SAUCE patch is not needed anymore, and even worse, it's adding a
potential NULL pointer dereference in cachefiles_read_backing_file(),
because we do a put_page(newpage) and set newpage = NULL in the main
loop in case of -EEXIST and afterwards we call put_page(newpage) again.

Dropping the SAUCE patch is enough to have the page leaking issue fixed
and prevent the NULL pointer dereference.

Signed-off-by: Andrea Righi <andrea.righi at canonical.com>
---
 fs/cachefiles/rdwr.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 0fa644116834..8ffc40e84a59 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -507,8 +507,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
 				goto installed_new_backing_page;
 			if (ret != -EEXIST)
 				goto nomem;
-			put_page(newpage);
-			newpage = NULL;
 		}
 
 		/* we've installed a new backing page, so now we need
-- 
2.32.0




More information about the kernel-team mailing list