Skip to contentSkip to conversation

squashfs-reject-negative-file-sizes-in-squashfs_read_inode.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Sep 28, 2025 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: Squashfs: reject negative file sizes in squashfs_read_inode()
has been removed from the -mm tree. Its filename was
squashfs-reject-negative-file-sizes-in-squashfs_read_inode.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Phillip Lougher <[email protected]>
Subject: Squashfs: reject negative file sizes in squashfs_read_inode()
Date: Fri, 26 Sep 2025 22:59:35 +0100

Syskaller reports a "WARNING in ovl_copy_up_file" in overlayfs.

This warning is ultimately caused because the underlying Squashfs file system returns a file with a negative file size.

This commit checks for a negative file size and returns EINVAL.

---

 fs/squashfs/inode.c |    4 ++++
 1 file changed, 4 insertions(+)
fs/squashfs/inode.c renamed from fs/squashfs/inode.c~squashfs-reject-negative-file-sizes-in-squashfs_read_inode +4 -0
@@ -197,6 +197,10 @@ int squashfs_read_inode(struct inode *in
 			goto failed_read;
 
 		inode->i_size = le64_to_cpu(sqsh_ino->file_size);
+		if (inode->i_size < 0) {
+			err = -EINVAL;
+			goto failed_read;
+		}
 		frag = le32_to_cpu(sqsh_ino->fragment);
 		if (frag != SQUASHFS_INVALID_FRAG) {
 			/*

_

Patches currently in -mm which might be from [email protected] are