diff mbox series

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

Message ID 20211019103307.27519-2-andrea.righi@canonical.com
State New
Headers show
Series Drop "UBUNTU: SAUCE: cachefiles: Page leaking in cachefiles_read_backing_file while vmscan is active" | expand

Commit Message

Andrea Righi Oct. 19, 2021, 10:33 a.m. UTC
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@canonical.com>
---
 fs/cachefiles/rdwr.c | 2 --
 1 file changed, 2 deletions(-)
diff mbox series

Patch

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