From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385400; b=oBZTUsp2HQ8tRe0P0MMkVFEWzeSh8gEcID6VkvQ+7YFBx/IY3QZR3yfSVRgX7ai6op3d cuWPAnP2jRD0R1OEIjvkfyvMx59bzPWJXMTj5mSzBMXltd5qSvN5nLgxpyzC3m4niOJZV gxaKjb14YbJ/BcAwFmD0JQFi1ewiejrpNRl3AHFMGcqzwGiaVgYITIcRooRbp/EdiO22d sukix7xjUaKhqwFommTsICVd03ILdxMpVSho86j3QES1Zy4irK1YvW0LTUuQenVU8+UFH Jnzb72MsBbc5J+6tBtc0+Lu/I685KcP+gctqOhGCPoFUCCxDSXZbZQfSAYO5RD3S+IQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385400; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EL9zvfqyItBX3H8uaZMyL1dPIcTekbMruHVk2UeOFYY=; b=lQk3LmdEaFFJTj7ptnBvJtI6XFvE4TScH4zRaeUDj3PqjyC/gcsgv/thMWJemX9S2dsW mEii/DaUMnhQMrwkiSGPNK2Ri9U4i8DK57DBtosX/A5zs5kTwXxaw2kq/WLEGC34inkAu ap6esJwxlouyCAVcbn60w+uEz3jvRZdXH5+59+LK/Vbu3FAUKk2q8EougEgkMgZlYvjI7 ueT/aP3lWCchqCrKvSOv67gMTFesPv+kt+Y4JQmFWHv2iOADBLmzeGHOp8lvQa4tFQhOE b9/q29Nqi7U5aLT5hdYYUyHOnMRsH+yAP3/QoXgMQAwTwt05pnBoY0tgyZtR4NJXqKQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="WnE6H+/+"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C7AE606A32C; Fri, 4 Dec 2026 11:56:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WnE6H+/+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id A77691F000CE; Fri, 4 Dec 2026 11:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385400; bh=EL9zvfqyItBX3H8uaZMyL1dPIcTekbMruHVk2UeOFYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WnE6H+/+Sj6WMM/uVKR/99FvTHZmgAc1lAQ43Cirk9GLADkEYdB6toCNiheji7hWI 8CLR1PerbUCmvCGHNgs7Ca5X7sLTG/MA7yzCb9gs545SA3JuEKV86lI2tambjmtfm6 uxFyFz/9XBDkWAXdDh2oi9dp6oHhEoAOzn1pDV0g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hyungjung Joo , HyeongJun An , "Christian Brauner (Amutable)" Subject: [PATCH 6.6 0539/1167] fs/adfs: bound directory entry name length in adfs_fplus_getnext() Date: Fri, 4 Dec 2026 18:59:26 +0900 Message-ID: <20261204100716.093839310@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: HyeongJun An commit ebf5025b0d989f95542fc9da899b7de2fec499f2 upstream. adfs_fplus_getnext() reads the per-entry name length bigdirobnamelen straight from the on-disk big directory and passes it to adfs_dir_copyfrom() as the copy length into obj->name[], a fixed ADFS_MAX_NAME_LEN (260) byte buffer. adfs_dir_copyfrom() only bounds the copy against the number of directory buffers, not the size of the destination, so a crafted image with bigdirobnamelen larger than the buffer overflows the stack-allocated object_info::name that adfs_fplus_iterate() passes in. adfs_object_fixup() may additionally append a four byte ",xyz" filetype suffix, so the accepted length must also leave room for that. The old-style directory parser (dir_f.c) already clamps names to ADFS_F_NAME_LEN, and adfs_fplus_validate_header() validates the header name fields, but the per-entry name length in the big directory format was never checked. Reject over-long entries, using -EIO as elsewhere in this file for a corrupt big directory. Reported-by: Hyungjung Joo Closes: https://lore.kernel.org/all/CAP_j_b9BqyQrk3D5nj6RSa=eGcs2HkRYsWc3WdXeXp9O3=z4nQ@mail.gmail.com/ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: HyeongJun An Link: https://patch.msgid.link/20260715115231.1585166-1-sammiee5311@gmail.com Signed-off-by: Christian Brauner (Amutable) Signed-off-by: Greg Kroah-Hartman --- fs/adfs/dir_fplus.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/adfs/dir_fplus.c +++ b/fs/adfs/dir_fplus.c @@ -192,6 +192,8 @@ adfs_fplus_getnext(struct adfs_dir *dir, obj->indaddr = le32_to_cpu(bde.bigdirindaddr); obj->attr = le32_to_cpu(bde.bigdirattr); obj->name_len = le32_to_cpu(bde.bigdirobnamelen); + if (obj->name_len > ADFS_MAX_NAME_LEN - 4) /* leave room for ,xyz suffix */ + return -EIO; offset = adfs_fplus_offset(h, le32_to_cpu(h->bigdirentries)); offset += le32_to_cpu(bde.bigdirobnameptr);