Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795407296; b=h+xFm4bWdYw5PX87z/nWV+v1uuaRCzoe1M3TYafwXgZd8BxRNHS5eIcT+YWxUChtAPE/ QpaGnH8tX9b4kfjYTE51dIY2W135ww8mnEYUoF8HMOdkCS5zdn9C6SEUNCHccaWCqPIpR 70QbMsxnusifVVdiOR4FeSKfo9wBM89ubBVCCHXfFTRksAEeOLFgoyu3KT8Ze+xd8G7x9 DFBTbNjF+3UMSA+im5edS6dezkeiKWKAV+Gb91IJK+Qffrr2HVAZsWtO7SRs9wXlC/jgo cP0KsZbWLslQ402lReTzWvOy1RbNJppFuVrcSzOIhG2nrIG/Ph9z7RjFI9cUzzen9KQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795407296; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=6fGL3P2JzWdq8oXo3oIq9G+bA6aD8oVEP4HmRkWboW4=; b=TUL1RCRCHazq5KqzfQBj606ZcVt737ZmCPFPELGCwtKpg8j2klK8YINcUagz0dDEie2E 8lMOtNiYGBISYIt7usOYbBxSIYeqA8+Ru3CnbAHJnsQ4QasDzqzCMMcZTYpet7AvWZdMb ThL2JEV5ppCqaTse1jJQVKJwWn6+imdOkRbNzXsYWQqT9SVT6GExqIOAVd4YVPrjUmjIv HkoxRdu0xUIuSjcQQU0lgR5kzYF/jY8tD9rNTeNsOBrctt82t5q/L3ipgh4MFMq2SlaUm 3cy90TsaWITRPt//L1cXs/aqRSwMHacC75ihQzH02mH9U/oOWapguqYbS+nmzHLM04g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=yNsqEIVb; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59995606A31A for ; Mon, 23 Nov 2026 04:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=yNsqEIVb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 773481F000C6; Mon, 23 Nov 2026 04:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1795407295; bh=6fGL3P2JzWdq8oXo3oIq9G+bA6aD8oVEP4HmRkWboW4=; h=Date:To:From:In-Reply-To:References:Subject; b=yNsqEIVb+jf+OQ2lVJ9QHwfk9OfP9uume7nRXYE24v7RIuujyURS14VQDzRtJcb1f GqKRfMseIrECcq7O4jrObXU51oANbTMyN6fPxR1XeNNsSpcxaAsqIFEGZQc9b9vz4F dzQY7ImkDiKWwVqzoqP3TkUktRNcfIXjsOy+kqeE= Date: Sun, 22 Nov 2026 20:14:54 -0800 To: mm-commits@vger.kernel.org,phillip@squashfs.org.uk, akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261123034304.261742-23-phillip@squashfs.org.uk> References: <20261123034304.261742-23-phillip@squashfs.org.uk> Subject: + squashfs-fix-regression-in-squashfs_copy_cache.patch added to mm-nonmm-unstable branch Message-Id: <20261123041455.773481F000C6@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: Squashfs: fix regression in squashfs_copy_cache() has been added to the -mm mm-nonmm-unstable branch. Its filename is squashfs-fix-regression-in-squashfs_copy_cache.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/squashfs-fix-regression-in-squashfs_copy_cache.patch This patch will later appear in the mm-nonmm-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 various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Phillip Lougher Subject: Squashfs: fix regression in squashfs_copy_cache() Date: Mon, 23 Nov 2026 03:43:03 +0000 In a recent commit updating the code to use folios, the bytes variable was changed from signed to unsigned in squashfs_copy_cache(). The bytes variable is used in a loop where PAGE_SIZE bytes are subtracted from it each time around the loop, and where the loop terminates once bytes is less than or equal to zero. The effect of the change in signedness is bytes no longer becomes negative when it is not a multiple of PAGE_SIZE, and the loop does not terminate when it should do, and instead folios are created and filled after file EOF. These beyond EOF folios are not visible to user-space and hence this is a silent regression. This commit fixes the code to only subtract the minimum of bytes or PAGE_SIZE, and which ensures the variable does not underflow. Link: https://patch.msgid.link/20261123034304.261742-23-phillip@squashfs.org.uk Fixes: 5641371fd0b3 ("squashfs; convert squashfs_copy_cache() to take a folio") Signed-off-by: Phillip Lougher Signed-off-by: Andrew Morton Cc: Christian Loehle Cc: Dan Carpenter Cc: Phillip Lougher Cc: syzbot ci fs/squashfs/file.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/squashfs/file.c~squashfs-fix-regression-in-squashfs_copy_cache +++ a/fs/squashfs/file.c @@ -410,6 +410,7 @@ void squashfs_copy_cache(struct folio *f struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; s64 i, mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1; s64 start_index = folio->index & ~mask, end_index = start_index | mask; + size_t avail; /* * Loop copying datablock into pages. As the datablock likely covers @@ -417,12 +418,13 @@ void squashfs_copy_cache(struct folio *f * grab the pages from the page cache, except for the page that we've * been called to fill. */ - for (i = start_index; i <= end_index && bytes > 0; i++, - bytes -= PAGE_SIZE, offset += PAGE_SIZE) { + for (i = start_index; i <= end_index && bytes; i++, + bytes -= avail, offset += avail) { struct folio *push_folio; - size_t avail = buffer ? min(bytes, PAGE_SIZE) : 0; bool updated = false; + avail = min(bytes, PAGE_SIZE); + TRACE("bytes %zu, i %lld, available_bytes %zu\n", bytes, i, avail); push_folio = (i == folio->index) ? folio : @@ -436,7 +438,7 @@ void squashfs_copy_cache(struct folio *f if (folio_test_uptodate(push_folio)) goto skip_folio; - updated = squashfs_fill_page(push_folio, buffer, offset, avail); + updated = squashfs_fill_page(push_folio, buffer, offset, buffer ? avail : 0); skip_folio: folio_end_read(push_folio, updated); if (i != folio->index) _ Patches currently in -mm which might be from phillip@squashfs.org.uk are squashfs-convert-squashfs_compressed_-to-inline-functions.patch squashfs-convert-squashfs_inode_-and-squashfs_mkinode-to-inline-functions.patch squashfs-convert-squashfs_fragment_-to-inline-functions.patch squashfs-convert-squashfs_lookup_-to-inline-functions.patch squashfs-convert-squashfs_id_-to-inline-functions.patch squashfs-convert-squashfs_xattr_-to-inline-functions.patch squashfs-fix-offset-in-squashfs_read_inode-trace-statements.patch squashfs-dont-compute-start-or-alloc-memory-on-empty-directory-or-index.patch squashfs-fix-fragment-bytes-overflow-on-32-bit-architectures.patch squashfs-fix-fragment-index-table-length-too-large-exploit.patch squashfs-sanity-check-inode-metadata-block-location.patch squashfs-sanity-check-directory-metadata-block-location.patch squashfs-widen-xattr-count-variables-and-add-sanity-check.patch squashfs-very-large-files-can-exceed-an-int-or-size_t.patch squashfs-add-more-sanity-checking-to-squashfs_block_size.patch squashfs-sanity-check-fragment-block-location-and-range.patch squashfs-sanity-check-block-list-sizes-and-range.patch squashfs-dont-store-large-export-table-indexes-in-memory.patch squashfs-dont-store-large-fragment-table-indexes-in-memory.patch squashfs-dont-store-large-xattr-id-table-indexes-in-memory.patch squashfs-fix-variables-in-directory-code-and-add-more-sanity-checks.patch squashfs-fix-regression-in-squashfs_copy_cache.patch squashfs-check-index-isnt-greater-than-s64_max-in-squashfs_read_data.patch