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)
committerRichard Weinberger <richard@nod.at>
Sun, 25 Feb 2024 20:07:59 +0000 (21:07 +0100)
commit723012cab779eee8228376754e22c6594229bf8f
tree3d4017ea695437f2c0cf6e7e780e3955a5feedde
parentb401b621758e46812da61fa58a67c3fd8d91de0d
ubifs: Set page uptodate in the correct place

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>
fs/ubifs/file.c