* [obsolete] squashfs-make-the-fragment-index-table-bounds-check-overflow-safe.patch removed from -mm tree
@ 2026-11-13 3:04 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-11-13 3:04 UTC (permalink / raw)
To: mm-commits, stable, phillip, kmehltretter, akpm
The quilt patch titled
Subject: squashfs: make the fragment index table bounds check overflow-safe
has been removed from the -mm tree. Its filename was
squashfs-make-the-fragment-index-table-bounds-check-overflow-safe.patch
This patch was dropped because it is obsolete
------------------------------------------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
Subject: squashfs: make the fragment index table bounds check overflow-safe
Date: Sat, 22 Aug 2026 16:33:28 +0200
squashfs_read_fragment_index_table() checks that the table fits before the
next one with:
if (fragment_table_start + length > next_table)
return ERR_PTR(-EINVAL);
fragment_table_start comes from the superblock and is not validated before
this point. A start of 2^64 - length wraps the sum to zero, so the check
passes regardless of next_table and fails to reject the invalid table
ordering.
length then reaches kmalloc() through squashfs_read_table(). A fragment
count of 0xffffffff asks for 64MB, order 14. GFP_KERNEL does not include
__GFP_NOWARN, so the page allocator warns before the mount fails with
-ENOMEM. With panic_on_warn, the warning panics the kernel.
Compare the operands instead of adding them. id.c and export.c avoid the
same wrap with an exact-size check. Keep the inequality here because a
gap before the next table is still allowed.
Link: https://lore.kernel.org/20260822143328.68867-3-kmehltretter@gmail.com
Fixes: 1cac63cc9b2f ("Squashfs: add sanity checks to fragment reading at mount time")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Assisted-by: Claude:claude-opus-5
Cc: Phillip Lougher <phillip@squashfs.org.uk>
Cc: <stable@vger.kernel.org>
---
fs/squashfs/fragment.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/fs/squashfs/fragment.c~squashfs-make-the-fragment-index-table-bounds-check-overflow-safe
+++ a/fs/squashfs/fragment.c
@@ -69,9 +69,11 @@ __le64 *squashfs_read_fragment_index_tab
/*
* Sanity check, length bytes should not extend into the next table -
* this check also traps instances where fragment_table_start is
- * incorrectly larger than the next table start
+ * incorrectly larger than the next table start. Both values are read
+ * from the filesystem image, so compare without adding them.
*/
- if (fragment_table_start + length > next_table)
+ if (fragment_table_start > next_table ||
+ length > next_table - fragment_table_start)
return ERR_PTR(-EINVAL);
table = squashfs_read_table(sb, fragment_table_start, length);
_
Patches currently in -mm which might be from kmehltretter@gmail.com are
userfaultfd-docs-fix-an-error-code-two-names-and-the-pollerr-cause.patch
squashfs-fix-fragment-index-table-sizing-overflow-on-32-bit.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-13 3:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 3:04 [obsolete] squashfs-make-the-fragment-index-table-bounds-check-overflow-safe.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.