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

Commit 50a9b214 authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: fix btrfs page_mkwrite to return locked page



This closes a whole where the page may be written before
the page_mkwrite caller has a chance to dirty it

(thanks to Nick Piggin)

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent a1ed835e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4552,11 +4552,14 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
	}
	ClearPageChecked(page);
	set_page_dirty(page);
	SetPageUptodate(page);

	BTRFS_I(inode)->last_trans = root->fs_info->generation + 1;
	unlock_extent(io_tree, page_start, page_end, GFP_NOFS);

out_unlock:
	if (!ret)
		return VM_FAULT_LOCKED;
	unlock_page(page);
out:
	return ret;