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 9D95B43634C; Tue, 21 Jul 2026 20:22:06 +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=1784665327; cv=none; b=Zz06vrLkxWm2mPmAZgLVmDhbZ/ebqdHoic7ZSVX2BzTOjnjtVs/KoW8ZgxqjeWOk0J5paJLA/G/iIcGBMQWLbdZWr7sazlm8cdJwOiY+3x2P1ROfzZL/DQHkS+R8Sw2RSmAp4Z2gMbt18sRvsQ8xCUUjYtdZn6nvzNB99/Jmaoo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665327; c=relaxed/simple; bh=4cZsnhke9HezrsR2G+NFBgBHMMOXM1t0P/AhwtqHW40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FGLGYcIBsDIsXx4MSNaRlMKh5041UnsUTeWoMY/SHaa1ahdIo/09sDlvoklCnjA+mPGmEKv8J501Wq6Y/VybSMwygta9jao0wk4OXO2pPw6eBiFe+KyVCKLYV+JpBeOZTS4WDEOzpze9M5TGcSKMSqjxAtnWl/vY0g+9uZCV5X4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=z0eAnQra; 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="z0eAnQra" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08F681F000E9; Tue, 21 Jul 2026 20:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784665326; bh=6GQKOdUv8h5qUAybMBqMzaIQjbeb6CQR9qMQZg+y3nA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=z0eAnQraD/YFLklbjFEUHM3Myu3KCloSMQ8OtnNKoNj3lSq2ahElS/2Z2E+c0NtJy 7ryghPNcmCGFH/2nNlDjmfOOGMTg832D0+9PwGgusDWvbIbSBXjLTr25Lfdu88uAtf RFGszHgaxxbD1+FAu+oaJsKpUQ6ospsa2i1DSJiA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryam Vargas , Jan Kara Subject: [PATCH 6.6 0261/1266] udf: validate VAT header length against the VAT inode size Date: Tue, 21 Jul 2026 17:11:38 +0200 Message-ID: <20260721152447.657909359@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bryam Vargas commit d8202786b3d75125c84ebc4de6d946f92fde0ee8 upstream. udf_load_vat() takes the virtual partition's start offset straight from the on-disk VAT 2.0 header without checking it against the VAT inode size: map->s_type_specific.s_virtual.s_start_offset = le16_to_cpu(vat20->lengthHeader); map->s_type_specific.s_virtual.s_num_entries = (sbi->s_vat_inode->i_size - map->s_type_specific.s_virtual.s_start_offset) >> 2; lengthHeader is a fully attacker-controlled 16-bit value. If it exceeds the VAT inode size, the s_num_entries subtraction underflows to a huge count, which defeats the "block > s_num_entries" bound in udf_get_pblock_virt15(); and on the ICB-inline path that function reads ((__le32 *)(iinfo->i_data + s_start_offset))[block] so a large s_start_offset indexes past the inode's in-ICB data. Mounting a crafted UDF image with a virtual (VAT) partition then triggers an out-of-bounds read. Reject a VAT whose header length does not leave room for at least one entry within the VAT inode. Fixes: fa5e08156335 ("udf: Handle VAT packed inside inode properly") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas Link: https://patch.msgid.link/20260612-b4-disp-9a2317ee-v1-1-fefef5736154@proton.me Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/udf/super.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1232,6 +1232,14 @@ static int udf_load_vat(struct super_blo map->s_type_specific.s_virtual.s_start_offset = le16_to_cpu(vat20->lengthHeader); + if (map->s_type_specific.s_virtual.s_start_offset + > sbi->s_vat_inode->i_size) { + udf_err(sb, "Corrupted VAT header length %u (VAT inode size %lld)\n", + map->s_type_specific.s_virtual.s_start_offset, + sbi->s_vat_inode->i_size); + brelse(bh); + return -EFSCORRUPTED; + } map->s_type_specific.s_virtual.s_num_entries = (sbi->s_vat_inode->i_size - map->s_type_specific.s_virtual.