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 4F901285068; Mon, 23 Mar 2026 16:11:02 +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=1774282262; cv=none; b=ga7kjxitKfI4bQvHQOpUGi0i3m4EKZglfa+bY8lUF4fmWLSpgc3k7N9xeDR2sXoNJLDu6F+rJFjnH26vsKur3HgCOjGWpu0D8+aougTKTQrEDz13pF0wQrDoh7HAmFSesP/CYhEF8Hh32cJ7hNmQcbatohbBhZIWFJsINIxYUgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282262; c=relaxed/simple; bh=I/3W6nz5bny5OgPaBpiwWWdzPOJpUwy5bUbB8+PhdHc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PpX7KwU45BIfj85vghj+Va09b6FR8ZcxIOb+ohjIrIz+mr/LxYrKpk/3DAr9ZrZfILd+bFQpyjnQS7xocvM0dkDDgy1+/qxVfFwj9L/M83PCBoQNm55/9yJcvSTyuAEq71+r9FJIq4nQF7T3rUr696D63f7C+an4RVcvRI9HDDI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j4rnrOTs; 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="j4rnrOTs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D0A5C4CEF7; Mon, 23 Mar 2026 16:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774282262; bh=I/3W6nz5bny5OgPaBpiwWWdzPOJpUwy5bUbB8+PhdHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4rnrOTsKzdjLH31UkuJsA3xOImdNfCgFXu0K8qfWxTL2bu9iCaZTzW8O+IzokDe6 shKXB8gy8SAk8TW5QRukdS4+kgMHtKBQpciANGj/4zRNGXGxTB0pC94r0HejUCb14g r1yBI2iGUUNXgXSd1WylN9twQsiB8KcPvF/66vzg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+a9747fe1c35a5b115d3f@syzkaller.appspotmail.com, Phillip Lougher , Christian Brauner , Andrew Morton Subject: [PATCH 6.1 089/481] Squashfs: check metadata block offset is within range Date: Mon, 23 Mar 2026 14:41:11 +0100 Message-ID: <20260323134527.436869253@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134525.256603107@linuxfoundation.org> References: <20260323134525.256603107@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Phillip Lougher commit fdb24a820a5832ec4532273282cbd4f22c291a0d upstream. Syzkaller reports a "general protection fault in squashfs_copy_data" This is ultimately caused by a corrupted index look-up table, which produces a negative metadata block offset. This is subsequently passed to squashfs_copy_data (via squashfs_read_metadata) where the negative offset causes an out of bounds access. The fix is to check that the offset is within range in squashfs_read_metadata. This will trap this and other cases. Link: https://lkml.kernel.org/r/20260217050955.138351-1-phillip@squashfs.org.uk Fixes: f400e12656ab ("Squashfs: cache operations") Reported-by: syzbot+a9747fe1c35a5b115d3f@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/699234e2.a70a0220.2c38d7.00e2.GAE@google.com/ Signed-off-by: Phillip Lougher Cc: Christian Brauner Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/squashfs/cache.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/squashfs/cache.c +++ b/fs/squashfs/cache.c @@ -340,6 +340,9 @@ int squashfs_read_metadata(struct super_ if (unlikely(length < 0)) return -EIO; + if (unlikely(*offset < 0 || *offset >= SQUASHFS_METADATA_SIZE)) + return -EIO; + while (length) { entry = squashfs_cache_get(sb, msblk->block_cache, *block, 0); if (entry->error) {