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=1796383825; b=rAqu+I86n2xsREC1zsGMmqsjbid1p8925Kmr6BJ+5tnkI/klGp1qPLaKCixZ+XzAYcBS 13T6ZBcXKkoQenQHG6ICCy2Y0PA6KdgZxizwkuFpW7B3VU63z94NpwWjLZhsZseLtUTdJ f0ls+54MN3s6NVx5uniiFY3WYlac6yBPYKnKCB8Hn5vaMhsz3/LJ/nqwHYVL6oAo443il 4lTCQJSUTN8ZjfYggekhmnNfnC6DzLLE1L31784dBWbY2ovtnCVICUF20BnyGANrcWG1e sxkjxoyerYx9WuHZrJVAYKzSw2qDh2ZAY6ZEJleKK+RpMbx1YKrfONJN+83ewy4ajVw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383825; 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=CUB3WBVQ6a0Iq9oyr5rg0ux4mrgjoS2PTceGx+/uZWU=; b=LZ8VyCyIB8rMex9tZFBIVZL6IJDy0NLTa7/ZZ4/t/suPh5j2tvwSP+TZDoxCG8QW8JqO qzr+mwZIg6dRhpAlxDO78gnc2WDcSCdWyfizCbbier4mty/RoOSEaU3bFbTWiFCaCH/22 jflyd8I9+BwGbXRDY6MTvraIeKJQCoHJQPc6PTDCancSni1KLOIInjRmbaKGMofZaObHt ABLyoIXiU3L2A5qUC/vllt+lCjC5OL3a07kRjf/Mrg2G5O7exTMvcfS3O+Pe6caBdSi2K RBCT1jv1wLu4CmQu22N86+2PhrKq0TO3F5BUywPIIFyKnQCJ2bTF/sDXQSHIhczrOnQ== 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=ba5nXcPY; 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 027C1606A322; Fri, 4 Dec 2026 11:30:25 +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=ba5nXcPY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735EC1F000C2; Fri, 4 Dec 2026 11:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383824; bh=CUB3WBVQ6a0Iq9oyr5rg0ux4mrgjoS2PTceGx+/uZWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ba5nXcPYPzIAYohErgSUtiZIk28ToBJ1pfcGIryFd65pk6zsNzCHW+7e0USFlR73r KhRnaaQ0bP+YPgOl9g033SzAa+fwImEraB3nQZ6tlH8jOMPfMlQZMptjvOx3f02dBI f2Er1F9Eg324Qn7ttRED2FW8uQ630pJIs4DwoAQY= 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.12 384/555] fuse: skip dcache instantiation for readdirplus names with embedded NUL Date: Fri, 4 Dec 2026 19:07:07 +0900 Message-ID: <20261204100624.412225850@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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 6.12-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 @@ -192,6 +192,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);