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=1796389402; b=WN5dZi5XcwjhDGKFBe2qnS6uiuk7DsuXuq37bOprn3VMijBYSbb++Yn10ZtAp53kvmyY x2gh4rI+6HThgNo06hpkCy467G3u3n6yuryNWACdLIvs1mnpbCp5Enqy13U05njR5UTbQ RHC8Bb7sDGra93ko8GTekAWiwlWEjN2RXdPF+/A/wZdLaPfXa4G9swrcp50cJWDJtEZej qvGedyqKRWHv1KxkgNKpe7P7zOSkoAw1unQffWUSDuedCOSJeJL0lgMCs2mmgfJ+fUju7 hNQWW4yJfNSDi57kWtx0YDtCFvxjytxNPgJLHjFcHw+3oyUgZbKoalGm0CHZpwqfjzA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389402; 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=/f5ajha5XbMyQJGDHDY7A7wjBGxWNmmJuZ1+UPOVuVU=; b=Ie1stkw1UG+RplMSMyKRAZ8Cy0njIj25syXbQcA+gAm/TCdz03Zeb7WgXgUJXFl9TKxJ 2HtaW7yk5NR+gcvvdLU13wrW+v8MqrL9i4VOOuWzfaqI2GN2uDeR2e0hgp1Y0XKDzgnbJ XHx+nVMGATEqOtsEalwQeOZb5Q0/qMX97OAHSfG1WdG+MIkvpyFY21MSMZ6YcyFXzCanA 2ebrFZZpiukcoD+bMmY68Iy0KFqLUD/DH/lhLkDy3ci9LZxL8bD2xvBbvvtCEJ+iFVq2e mNS2MeZwTaIQgld90jVihH3OT+qUCzpGakQNdrbIszqceyGetyNENfoN7x7V67ReHSg== 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=CPvwW0AW; 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 10540606A322; Fri, 4 Dec 2026 13:03:22 +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=CPvwW0AW Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BE541F000CE; Fri, 4 Dec 2026 13:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389401; bh=/f5ajha5XbMyQJGDHDY7A7wjBGxWNmmJuZ1+UPOVuVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CPvwW0AWRWY69l/CC0KYhZydQw7ypAsv5WA7sPVaiYuTBw3ZrbotRVg8hAdLkZB64 0HU2CzlCcHTjVWOJ+1wI6agV7x0UbZydV0CXEI8FAFZvo5NcLqlLsve/A2FhrzcrK0 Mkr/ysjxUBqVgOlRHI61j5BC6Tnnj4MaVCcAy1DU= 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.1 0937/1059] fuse: skip dcache instantiation for readdirplus names with embedded NUL Date: Fri, 4 Dec 2026 19:07:48 +0900 Message-ID: <20261204100708.296049078@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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);