The patch titled Subject: squashfs: fix buffer release race condition in readahead code has been added to the -mm mm-hotfixes-unstable branch. Its filename is squashfs-fix-buffer-release-race-condition-in-readahead-code.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/squashfs-fix-buffer-release-race-condition-in-readahead-code.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Phillip Lougher <phillip@xxxxxxxxxxxxxxx> Subject: squashfs: fix buffer release race condition in readahead code Date: Thu, 20 Oct 2022 23:36:16 +0100 Fix a buffer release race condition, where the error value was used after release. Link: https://lkml.kernel.org/r/20221020223616.7571-4-phillip@xxxxxxxxxxxxxxx Fixes: b09a7a036d20 ("squashfs: support reading fragments in readahead call") Signed-off-by: Phillip Lougher <phillip@xxxxxxxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Cc: Bagas Sanjaya <bagasdotme@xxxxxxxxx> Cc: Dimitri John Ledkov <dimitri.ledkov@xxxxxxxxxxxxx> Cc: Hsin-Yi Wang <hsinyi@xxxxxxxxxxxx> Cc: Mirsad Goran Todorovac <mirsad.todorovac@xxxxxxxxxxxx> Cc: Slade Watkins <srw@xxxxxxxxxxxxxxxx> Cc: Thorsten Leemhuis <regressions@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/squashfs/file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/fs/squashfs/file.c~squashfs-fix-buffer-release-race-condition-in-readahead-code +++ a/fs/squashfs/file.c @@ -506,8 +506,9 @@ static int squashfs_readahead_fragment(s squashfs_i(inode)->fragment_size); struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; unsigned int n, mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1; + int error = buffer->error; - if (buffer->error) + if (error) goto out; expected += squashfs_i(inode)->fragment_offset; @@ -529,7 +530,7 @@ static int squashfs_readahead_fragment(s out: squashfs_cache_put(buffer); - return buffer->error; + return error; } static void squashfs_readahead(struct readahead_control *ractl) _ Patches currently in -mm which might be from phillip@xxxxxxxxxxxxxxx are squashfs-fix-read-regression-introduced-in-readahead-code.patch squashfs-fix-extending-readahead-beyond-end-of-file.patch squashfs-fix-buffer-release-race-condition-in-readahead-code.patch