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=1796380920; b=udiT+5qiCamcqMVez5Mc4SgDNEFSdzHxfL4zUvB299/mKOndJ5WkXxHCa6EpPHCOw3Al HUanHkdxOue+hlitm9UBdpbK4DN5mEOQ3+JCga5KLcW3xI3w35JWBK6CdXI30eOJG2gkf vAK/P/RgKIWO/izm5l2HwdfMPJP2L23MylR424vewtfXz1SS9WE7hWggrx6Vt02kAMrUB dYlyIIdK45zJx5bhWYOASX3IhuWqOMmTOxARCnVe4r1OwPAqQsmNytahE7fE+1I2VLqfe Ye0xHn/Q/dL21V/wlW1K99beRFdJmSUjrgSXq8p3QEROuHtEzWlvQw1mB4QLz18WFKQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380920; 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=V8jpJdXuBtfn+39raWxCZz6gO+5I00yX53Qm3Goi4sk=; b=NmC5JbOmfcm5X3yRFbaAq5orAi0B98fP5fkrMQTmpnZTYvpEupfhaoApimNaWggNrmtK BfglheuJ4gleiOVjNC3Riu0b9E4UFbnQWkYbJU/U5SnzSlEgTV2crQLrcTtcQPp58PejT kjCTloNxXs72crX+ApB2ZiI1fVBTkvgOZSfp3ZsE/XKZErPOalFrkxLlsUcfp3lTWNaOv Hx3AB0kQxpP+m10amV6wVkL2qX6wKbrW6akp3hmbNMKKiuWAgBUTr7qaOsPnF+s74kZ0I ZOzOT5gpeno54uMrqnmpwGSafqG11vYk+tHa0LEv1xrivaN+x7kVoDPyS5BZEUXa7UQ== 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=sAqmW9Ra; 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 81E66606A322; Fri, 4 Dec 2026 10:42:00 +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=sAqmW9Ra Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFDC81F000C2; Fri, 4 Dec 2026 10:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380920; bh=V8jpJdXuBtfn+39raWxCZz6gO+5I00yX53Qm3Goi4sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sAqmW9RaP6lWxw1Q6kDs5tXqyecERClwoJhseBxHyg9+7eEjkc8hL3Tapg/32I9J8 +LdpoYsY3ueVjNbAVP0MHFes6vV1ldrBLh4gMdiNlfCQew+FoPlOy/f2jsjqmjTjFI nsMgAMpieBlKrTrwJujow3syM/Bt0xvswRCq7j/E= 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 7.3 479/742] fuse: skip dcache instantiation for readdirplus names with embedded NUL Date: Fri, 4 Dec 2026 19:05:43 +0900 Message-ID: <20261204100647.869641192@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-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 @@ -191,6 +191,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);