Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9fd1605e authored by Vignesh Radhakrishnan's avatar Vignesh Radhakrishnan Committed by Prasad Sodagudi
Browse files

fs: fuse: lock the new non-CMA page before replace_page_cache_page()



While swapping a page in FUSE filesystem from a CMA to non-CMA page,
we call replace_page_cache_page() to swap and this function expects
old and new page to be locked. Else we will hit a VM_BUG_ON in
replace_page_cache_page().

Hence, lock the page before calling replace_page_cache_page() to
satisfy its requirement and prevent hitting VM_BUG_ON condition.

CRs-Fixed: 751088
Change-Id: I1dbb90dbaa9f056f211754bad15ae76c9d7171a5
Signed-off-by: default avatarVignesh Radhakrishnan <vigneshr@codeaurora.org>
Signed-off-by: default avatarPrasad Sodagudi <psodagud@codeaurora.org>
parent c2e43a22
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -914,8 +914,10 @@ static int fuse_readpages_fill(void *_data, struct page *page)
			return -ENOMEM;
		}

		lock_page(newpage);
		err = replace_page_cache_page(oldpage, newpage, GFP_KERNEL);
		if (err) {
			unlock_page(newpage);
			__free_page(newpage);
			page_cache_release(oldpage);
			return err;
@@ -925,7 +927,6 @@ static int fuse_readpages_fill(void *_data, struct page *page)
		 * Decrement the count on new page to make page cache the only
		 * owner of it
		 */
		lock_page(newpage);
		put_page(newpage);

		/* finally release the old page and swap pointers */