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 6389C219A7A; Fri, 17 Oct 2025 15:24:32 +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=1760714672; cv=none; b=cuNzyP55Wyy6sQ89ShNT/G1NApE/Nj3QXtJoN0HBxXVAM24dCcgyloSnfZjtwEOMMi5Iybzm4Wozrv7qoOAHyBJMLG9bRi5SUyOQ9y6zF5oWWdZ4tUeYLabPFLFhv6/cWFyF8wCsURd60qQqOrNHEFyTBb8joVP6L5yNKCRJ0KM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760714672; c=relaxed/simple; bh=b1LO+f1xjPF39vyJ+d30q3F+mKBQ0/XAsc+8jy4kP6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R0gQNu/vDdE4mwzqEK51N0FPRQpQetOC5RNSfObABrjNGFpzNXxm0C5zz7Ka+QCfZ+zitHrt1TtzOczQtw0ytyuM02UUmnBoweASWPcHazoGxdlFHbIubKzpVnXBAm8Hmdew2nuMHC1MqnkSqVygCtYUkyXVraGHIgI8XGFeUVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CBQiDL0i; 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="CBQiDL0i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DECB1C4CEE7; Fri, 17 Oct 2025 15:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760714672; bh=b1LO+f1xjPF39vyJ+d30q3F+mKBQ0/XAsc+8jy4kP6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CBQiDL0iZvxl20vB6/FKpBNSwfZHEHRuSrFZYzvDDflRb9qZwxnvCmc5a+8GYr/UG LXK4LFaPw9uvo0nt52gVQAxULiUaDTwnDWZCDxH06qk91+YRhlKQvehko+dW/5ikcx 2td6VWqE8KbG/3PB6AXKJQJUiB9STmyja3b7sY+Q= 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.12 226/277] Squashfs: reject negative file sizes in squashfs_read_inode() Date: Fri, 17 Oct 2025 16:53:53 +0200 Message-ID: <20251017145155.380305226@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251017145147.138822285@linuxfoundation.org> References: <20251017145147.138822285@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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) { /*