]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ubifs: Set page uptodate in the correct place
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 24 Jan 2024 17:52:44 +0000 (17:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:28:20 +0000 (15:28 +0200)
commitfc99f4e2d2f1ce766c14e98463c2839194ae964f
treee0da972e50970eed58e1b55c257aebb27dca1428
parentab8f9df1069438b352e2e33d7683f00b7a54b9eb
ubifs: Set page uptodate in the correct place

[ Upstream commit 723012cab779eee8228376754e22c6594229bf8f ]

Page cache reads are lockless, so setting the freshly allocated page
uptodate before we've overwritten it with the data it's supposed to have
in it will allow a simultaneous reader to see old data.  Move the call
to SetPageUptodate into ubifs_write_end(), which is after we copied the
new data into the page.

Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ubifs/file.c