From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53DA83314B3; Fri, 17 Oct 2025 15:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760715826; cv=none; b=nNqQUwXGRXgYxfN4izrh/5m0+szcxqgmFQiSIvvdmDQiLmEmF9IBYMThYlokR0Rqd4XGUtl8c7ImJ4sAh2iR0xrfjikAFIrjluR7Y+OuW2SMhR+UEl0HRn1ImWktktS8QssKZjLyXLeGkmk/zaKgLh/kO+7vQRBSvqO4AsJVjC0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760715826; c=relaxed/simple; bh=j9afa9PJKQbrK7emabOVuGtJwVY2GepTcjAtpfuWpKk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tOWOOesamEjTCNUMw0CXaBg6+zafCuyeq0Cu+0z8/4czt1pI0AVPq2iEv6Seyh1Dvw1NrPUXAA7TY+TKhEoOe2bDXZRM/idr5R6v9zstxhNU2ZK7i1LwBsg9EzApK0JKM1SswzTge/UmhIi0GnR2uLBlxAHQ9vUT0LkvmygZtLQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=z4c4HkSK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="z4c4HkSK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEA45C4CEFE; Fri, 17 Oct 2025 15:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760715826; bh=j9afa9PJKQbrK7emabOVuGtJwVY2GepTcjAtpfuWpKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4c4HkSK+4s6CJbGZMjMl61iEgFMy9btO1zffsInorKAp78tJq7Syd/uHcjgtL2uL /6aCIC5af1CiYDhFj4ewX1md8aMawViE51oM0CO6Jq2Bv4YoE+NmbM7N99mE7SytCX fWyOsQe8rLNvm3FZhA6By67IxrtV/GSEzmb081cM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Phillip Lougher , syzbot+f754e01116421e9754b9@syzkaller.appspotmail.com, Amir Goldstein , Andrew Morton , Sasha Levin Subject: [PATCH 6.17 351/371] Squashfs: reject negative file sizes in squashfs_read_inode() Date: Fri, 17 Oct 2025 16:55:26 +0200 Message-ID: <20251017145214.779954565@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251017145201.780251198@linuxfoundation.org> References: <20251017145201.780251198@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Phillip Lougher [ Upstream commit 9f1c14c1de1bdde395f6cc893efa4f80a2ae3b2b ] 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. [phillip@squashfs.org.uk: only need to check 64 bit quantity] Link: https://lkml.kernel.org/r/20250926222305.110103-1-phillip@squashfs.org.uk Link: https://lkml.kernel.org/r/20250926215935.107233-1-phillip@squashfs.org.uk Fixes: 6545b246a2c8 ("Squashfs: inode operations") Signed-off-by: Phillip Lougher Reported-by: syzbot+f754e01116421e9754b9@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/68d580e5.a00a0220.303701.0019.GAE@google.com/ Cc: Amir Goldstein Cc: Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/squashfs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/squashfs/inode.c +++ b/fs/squashfs/inode.c @@ -193,6 +193,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) { /*