From nobody Mon May 25 08:11:31 2026 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0AC217B506 for ; Fri, 15 May 2026 14:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778855018; cv=none; b=sdJRSay6divydazemsBGKlkrdrQcrr0VBOsPaWdGuYsevNjOO+u84PPL0tcwHoL37xMvuY/J1zvA0WeflBePHFmqFfwf4QZM3PEYeblhUlyJ3czwuzS+BArmEriqwangMsQTXspIKUIKf8MdvmwVu2ez7sNKPBt1W8/kH2mTg6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778855018; c=relaxed/simple; bh=6Fx/3w1xEEg7EjXynoqxgB8ViKVnW/dwckxQjeeKoH0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=a+4TcgE8veg2L12YQ3RYkbmsToSXIAQhSVEj/KgJ4Y0AMPstI5lmkTE7uGmGwlfRduR7cdscP3bZPwg5/6u2NQYFtr9sj8bqtSEtPXaihxAMoeukxzH9Tg8o62EfDOEaoT4+LHKruPX8774MDQKVcxUf7ptI/BZTKpbbAnCPRNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WmQz0DdW; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WmQz0DdW" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-8b4298d271fso144866406d6.3 for ; Fri, 15 May 2026 07:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778855016; x=1779459816; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+g+9yWPWB6JQ65FM6GitniOIUqlSbPWyCQxbcWB+lx0=; b=WmQz0DdW4WTsUhC5sRB2rDLzq5yN2N30g3c72Gf6uSBke7kP3S1rbhVHgnzD8esh/R 3v5zkXTN1xBvKFpVRffiumfERO3PvEZPB0tSyZZ7RM7lI202A9qqg8L5A/cq4PVZffJT cfi09bNdjXlIFufpADYNZN4lxZ/gFsIPYqyNE06U6FPyVWIH/5Qm7ZvisvgjWenuEiSu RanLs27FLuLIlqy6WcalZnRIKl+fvA6pWlapx30CSU3Jq/TwmPj7nm1wZpw+o8ZDkBFw Q9a/UOJN8c352DFWxDCEmW9OS4IIhQ7aQY3bILkm/2hPgo5ZY7C5u3hdVPzdDGMqP3pu nT4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778855016; x=1779459816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+g+9yWPWB6JQ65FM6GitniOIUqlSbPWyCQxbcWB+lx0=; b=Ldvi8xJ6SxcvSfbZY5zXk/OQpZRr2r1VbY6OEFCYYAAr3IAACovYrDNxr3CXDQjDtw x46mBixenQ52TJiTohNpozYEIU1bpJXaiozbVnJqidCrtepjFntIRRRyXnZPDRTOZkBg atC0lCzcqktetHC52aOt4/dCPiKuhlUZHlOsZNLdJEWure1GqOt1/O4Dg0/RLncg3pUw mZ+R+RSHLCtkriLtWdeQp6fAA6I3ruJyipV50qlDJgG/DMnkd+Al922RrghlB/g8xaU8 Tsd14SFiH//OxGsc4x6ECDIk2J3WOLlM5JsVuStfJZUVAVfStjGGnH1gQh/5MXXZVZc5 VCrQ== X-Forwarded-Encrypted: i=1; AFNElJ8ipnCxb+aAk6XpfhBpsaeIkE/V7GQaCF8KPVjyShnT0uvX4br4tIU7AJP1fohIFnCR6jOQJb7eXcCy34k=@vger.kernel.org X-Gm-Message-State: AOJu0YzRu3NHxZXtR9FhxsgemXaWkR2LCAaJsu68TpAjUdPhnlqsI4uU 5YLBW0EmkJ4WYuMYdnasLtkBVi5FDeyEeUvA0bvpaKPpqYbY8JnJSBn9RBBbp4iT X-Gm-Gg: Acq92OHIk712KgDxHdvOUBNtezWywQRYEUYKsgsQOSqt9/4znFkEZzQrRd/Jpm/Dodx 44y9SCVIc46iB34SPn/3KvuHeFdkjXCAoO9OXbCesMRwAW9faz6WIWK4JXe9B+Mpbz0TyuJjETK 4Fg95eD/WTaQB+TwD6M00V992+ZkHxcLUCvt7yiaDnFP4bBx6PQkUkbHBqJMoi/dLGwu/iAK7cI 3jwzQLFlFqBR2uQKqOov8ryIHrWbxJncsZSsqT1RciGRtyfZNqfFZhJ5GgkVLBv+50FuqVdD9nU A7X9DrP0XaoCccMBGw4cN1vpVzvJNPlEhbbVglS/WqJZXOD+jm3MS8Y6O9LgLzIIkMYLfc7LtlQ N239JR24ZZzk+aNCVwZphQwo9yUAK6EL3HjqvuI1HjNtI1THb5Tu7Y/ABm91/J55c73Fu9Dezbp zzFBafFxzKEK87KAMLaEAPPeGbO81mbDcCiQZAw/ZA5sbg6LUMjqA7Lu/OlPrgM433dbxmkPpQ5 mY8Om6BICd7KYy+p0nSai1RjVlLu3OYYcEhaHRBnc0= X-Received: by 2002:a05:622a:1e89:b0:509:30b0:8323 with SMTP id d75a77b69052e-5165a0a4269mr57007001cf.31.1778855015753; Fri, 15 May 2026 07:23:35 -0700 (PDT) Received: from server0.tail6e7dd.ts.net (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-5164568a275sm45240951cf.5.2026.05.15.07.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 07:23:35 -0700 (PDT) From: Michael Bommarito To: Jan Kara Cc: Roman Smirnov , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] udf: validate free block extents against the partition length Date: Fri, 15 May 2026 10:23:27 -0400 Message-ID: <20260515142327.1120767-1-michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" udf_free_blocks() checks the logical block number and count against the partition length, but drops the extent offset from that final bound. A crafted extent can pass the guard while logicalBlockNum + offset + count points past the partition, which later indexes past the space bitmap array. A single ftruncate(2) on a file backed by such an extent reliably panics the kernel. This is a local availability issue. On desktop systems where UDisks/polkit allows the active user to mount removable UDF media without CAP_SYS_ADMIN, an unprivileged local user can supply the crafted filesystem and trigger the panic by truncating a writable file on it. Systems that require root or CAP_SYS_ADMIN to mount the image have a higher prerequisite. No confidentiality or integrity impact is claimed: the reproduced primitive is an out-of-bounds read of a bitmap pointer slot followed by a kernel panic. Use the already computed logicalBlockNum + offset + count value for the partition length check. Also make load_block_bitmap() reject an out-of-range block group before indexing s_block_bitmap[], so corrupted callers cannot walk past the flexible array. Fixes: 56e69e59751d ("udf: prevent integer overflow in udf_bitmap_free_bloc= ks()") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Michael Bommarito --- fs/udf/balloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 807c493ed0cd..cc6dc6e1d84d 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c @@ -82,8 +82,9 @@ static int load_block_bitmap(struct super_block *sb, int nr_groups =3D bitmap->s_nr_groups; =20 if (block_group >=3D nr_groups) { - udf_debug("block_group (%u) > nr_groups (%d)\n", + udf_debug("block_group (%u) >=3D nr_groups (%d)\n", block_group, nr_groups); + return -EFSCORRUPTED; } =20 if (bitmap->s_block_bitmap[block_group]) { @@ -662,7 +663,7 @@ void udf_free_blocks(struct super_block *sb, struct ino= de *inode, =20 if (check_add_overflow(bloc->logicalBlockNum, offset, &blk) || check_add_overflow(blk, count, &blk) || - bloc->logicalBlockNum + count > map->s_partition_len) { + blk > map->s_partition_len) { udf_debug("Invalid request to free blocks: (%d, %u), off %u, " "len %u, partition len %u\n", partition, bloc->logicalBlockNum, offset, count, --=20 2.53.0