From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 58D0726159E; Fri, 4 Sep 2026 06:14:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788502484; cv=none; b=oBZeGpQaGd4ZeUvoJrNL7DDbEvWLWNI9dKP7NjX5bkPhGbBvK8V3fSRSVWW4XWTEd9yzFmPWlh8x7JPUoktyPYVS8te1rj9wGd64AnZN8srKeR6dxSoHKi+jHpdtg0HvGGSJTR06tn33oTDc6lmqTUmV6pXD3ecaX9arXFcDIQg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788502484; c=relaxed/simple; bh=Wk+5LIPN7e7Ksi7A/sYJN1G84nLR2QiYJNF3+LQj1vE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pfuWrDQnY9ukw/qPanVBZ6SXo1mc7UlNf+IuP3FzMnlBwJ1H+Lgz8qiUlrK4rRnkK6mCl9+CNck5k5NylGz1dbEHG3N6Ps3UMX2xOYuhrJjkbXbWWXYsjuvAjq20bpd9osMQgI8olJ6bkW2xlmhANXG1ZDfhjB3qxIOZkVLbT7k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Dk3MjLVP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Dk3MjLVP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 126551F00A3D; Fri, 4 Sep 2026 06:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788502482; bh=5a522LfpOQuovY62JYBcL+39thu+L+sTQjZxGpNJPU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Dk3MjLVP2d7oSLp6/BFmLxGeoGXJVOQzBs8GTjbX2J2KcrPJBXGunj8c+xhtdBWMS /BuvcEOb2Y+8W65starhrN369Vs8WhNjHJznKA/1kQMJ+BztGUCnrx5cY/znxmc3h2 1+alQOv3ytQM1ZaDXxjPvwhdF3CjS/ZFJa8xFyOQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Lee , Jan Kara Subject: [PATCH 6.12 221/403] udf: reject VAT indexes equal to the entry count Date: Fri, 4 Sep 2026 07:00:24 +0200 Message-ID: <20260904045739.890395696@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045734.806166532@linuxfoundation.org> References: <20260904045734.806166532@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: David Lee commit cac0cb07f29ccfb373fd4a36c81e908ef3ce608c upstream. UDF 1.50 virtual partition mapping uses the VAT as an array of physical block mappings. s_num_entries stores the number of entries in that array, not the highest valid index. The valid VAT indexes are therefore below s_num_entries. udf_get_pblock_virt15() currently rejects only indexes greater than s_num_entries. A crafted image can request index s_num_entries, pass the bounds check, and make the kernel read one entry past the allocated VAT table. Change the check to reject block >= s_num_entries, so the count is handled as an exclusive upper bound. A crafted UDF image reproduced this on origin/master commit 0e35b9b6ec0ffcc5e23cbdec09f5c622ad532b53 with a KASAN slab-out-of-bounds report in udf_get_pblock_virt15(). Trail of Bits has a reproducer that triggers kernel panic demonstrating the bug, and can share it if needed. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: David Lee Assisted-by: Codex:gpt-5.5 Link: https://patch.msgid.link/20260708101712.1706564-1-david.lee@trailofbits.com Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/udf/partition.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/udf/partition.c +++ b/fs/udf/partition.c @@ -55,7 +55,7 @@ uint32_t udf_get_pblock_virt15(struct su map = &sbi->s_partmaps[partition]; vdata = &map->s_type_specific.s_virtual; - if (block > vdata->s_num_entries) { + if (block >= vdata->s_num_entries) { udf_debug("Trying to access block beyond end of VAT (%u max %u)\n", block, vdata->s_num_entries); return 0xFFFFFFFF;