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=1796382386; b=kRTmiVGsdeNvWUz+ZxMvL9ed756VVJ9VQTHEP7WmJdz4lvcSjypDjHG6eoqt9m/f/xry eyNOriS9cJNDYzzGoBvcSKa3AADODVIuxYVjB4eAnJfm2alY8iQSiAgwIhjDvAuKASFNG 3o1f7Jlc4onEnybRQHmCTbOa6xQzw+7HtfjgyX2QChpt3+1MSgbB3UpSjzJ74klcV9nzN 6Rfq+y0Z00rIm+kCnMXmYzXSZ+hLeIXW2JRhTicZjp386cWdHalgsM0hXk4q0IAwpvFha uf3aee8XhmaDR6KYbARARU/qjgX+Z8RvKtkvip85FAU0uRRpPSJRb9PnEDgS091v7cA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382386; 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=CosrQ/BBRryFBhHUjmTBQ+78dCvOuWHxBj5YIcd5T24=; b=yFb9fAiGpzzNI8C5jBnc0LN1cKye7iVMJY3fydxBXkJBy+Iw8oSRVHq5BIYKhwTPesaj sOUekOBwV6o1CVjjEAa0OFL/KurZWydGi8m1WXNOP+xnKjU9icly5lhV3rtDJkiCpO7MP u1RsSmviAQ+55jEKaQFdY+tNfHv5VQfwbI95Hz2f0yESaINS6NiAY/pHKCKS33Ltr4NUi lAcj22fr17fHtzPyTEiqcTkAbfejvolbqRQrPNAkbk3VoQjKogp5d6v7rhY5dL3jGsFVA XdHKaEKCcchr06EulvR2vd9IrXqMPI/FgZZA0/C0sXIFqiAQG9tL/zJCdxtRQdveAug== 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=j4OwSXcT; 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 79451606A322; Fri, 4 Dec 2026 11:06:26 +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=j4OwSXcT Received: by smtp.kernel.org (Postfix) with ESMTPSA id A91621F000CE; Fri, 4 Dec 2026 11:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382386; bh=CosrQ/BBRryFBhHUjmTBQ+78dCvOuWHxBj5YIcd5T24=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=j4OwSXcTd8b0prigZ/+dMS2UPOql+yHcvE7IIPuc9MqqXKAnuYQcIaoZcLDUMFGb7 LR2DzpEB0elDoKfWH2VcWvAiW17Nt2AUyKBGsxubaV1Ig9EX9ekLl6Iut08RptLuWB 69ZbEWbSO/zojlAV4TcyeCIkwnn70BbAuY/2iUiE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gwanhyun Lee , Junyoung Jang , Amir Goldstein , Miklos Szeredi Subject: [PATCH 6.18 431/703] fuse: skip dcache instantiation for readdirplus names with embedded NUL Date: Fri, 4 Dec 2026 19:05:30 +0900 Message-ID: <20261204100639.286417890@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Junyoung Jang commit ae932b1f5727004f585d603e0cbab7e0725c04cf upstream. FUSE READDIRPLUS can pass a length-bearing qstr with an embedded NUL to d_splice_alias(). Unlike verify_dirent_name() in fs/readdir.c, this path can create a dentry whose d_name.len extends past the NUL. For such a name, strscpy() in inotify_handle_inode_event() and the fanotify name-copy helpers stop early. The kmalloc() and kvmalloc() event-name buffers retain uninitialized bytes within the recorded name length, which copy_event_to_user() and copy_fid_info_to_user() can expose. Some FUSE servers include a terminating NUL in namelen. Follow nfs_prime_dcache() in commit 78d04af4995a1 ("NFS: nfs_prime_dcache must validate the filename") by skipping dcache instantiation without failing getdents(). Return -EIO from fuse_direntplus_link() so parse_dirplusfile() sends FUSE_FORGET for the unused lookup reference and continues readdir. Fixes: 0b05b18381ee ("fuse: implement NFS-like readdirplus support") Cc: stable@vger.kernel.org Co-developed-by: Gwanhyun Lee Signed-off-by: Gwanhyun Lee Signed-off-by: Junyoung Jang Reviewed-by: Amir Goldstein Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/readdir.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -194,6 +194,8 @@ static int fuse_direntplus_link(struct f return -EIO; if (fuse_invalid_attr(&o->attr)) return -EIO; + if (memchr(name.name, '\0', name.len)) + return -EIO; fc = get_fuse_conn(dir); epoch = atomic_read(&fc->epoch);