ubifs: Set page uptodate in the correct place
stable inclusion from stable-v5.10.215 commit 8f599ab6fabbca4c741107eade70722a98adfd9f category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9Q97O CVE: CVE-2024-35821 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8f599ab6fabbca4c741107eade70722a98adfd9f -------------------------------- [ 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: 1e51764a ("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> Conflicts: fs/ubifs/file.c [Conflicting patch 3b67db8a ("ubifs: Fix to add refcount once page is set private") is not adapted and merged into the current branch.] Signed-off-by:
Wang Zhaolong <wangzhaolong1@huawei.com>
Loading
Please sign in to comment