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=1796221078; b=2Bfu5mTa9F37Gl0hbEOk9pSsXyDvKpb0A1vExGWl6CgpUjxr89C6t9TnlZjOOBdcALy/ ZhLpr4OLsL11VeGes2QCx4gAfPp4aRtz17sduo/WrlEQfHp3vC8pFcLyN6NiONieopBBA tqMUoWzUKWuIsJBEi56f9yitjvzXwU00Byz2MoQUHV5RnJ5UnsxwKmTrsnnI/f3CNOz8d yXyC7dRJncbFBg2q3uUGDb9aRT6MEPFT0PY63lhL/EQV5yc1Px9OXYQre2zIeZSfnBE22 F556RHWKavuQpojBuNcZAQDHqfaqZ8XoZnDBnQs7Hn7xMArX4wiDHiSNhuxkc0WgrUg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221078; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=UsojZejEntcoR3+ju9KaH7zU1sV7izWQlKi9S8OzulA=; b=dzjVdM5fkPnzl2QfqYB3/XZxF5LsapxCPYFywq8MsU+EQ6S1w2F2iramVvk6XYwkPAMx Px7eYz1ebQ8tHyZkZC6R/ZAxlZwBxgvgqLZf6JFnkSuxYOKTJngDfZBpWAuaJZJxUaO9t t+S/SomgViXKPRMgaCNEuI7jNB/HIdKFsGHL8fig9Vo+kCTjugSXS/pYWEsJOu0KVHUul 62KVKkl37JAvo3vscSLPdgQPhChRPnB69Oy6x6ESS9N1PxLbU0+vxh7HmkrOx6ygAfe/T NtIIDjXMm1p6zVI9iP9F8uS4dGK28xFDbzGR4wTFIAP/iPK6sgkobHuWdc84OPPVjFQ== 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=NxCfcYX8; 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 F0263606A322 for ; Wed, 2 Dec 2026 14:17:57 +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=NxCfcYX8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0B831F000C1; Wed, 2 Dec 2026 14:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221077; bh=UsojZejEntcoR3+ju9KaH7zU1sV7izWQlKi9S8OzulA=; h=Subject:To:Cc:From:Date; b=NxCfcYX8Tzv/JnT/aIWDFaBtyOjD4eKt8/rj2xV4E6L6j74n6F+hXP7Cl9C5mp5eb gLJRS345kxGfV/DFqSCArE+1jIwPSa8QSH9sXquTLagXtk+WEK8DY8cIEjmu+f/uj9 NciuzDpTuGnI5l4I+bCp7cvQ22Kze+VYo8Zma4JQ= Subject: FAILED: patch "[PATCH] fuse: fix possible UAF in fuse_direntplus_link()" failed to apply to 6.1-stable tree To: mszeredi@redhat.com,sashiko-bot@kernel.org Cc: From: Date: Wed, 02 Dec 2026 14:03:19 +0100 Message-ID: <2026120219-crier-snowfield-e7fd@gregkh> 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-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 9191c2c1a76a759ac97be72481fdd4f9e920c902 # git commit -s git send-email --to '' --in-reply-to '2026120219-crier-snowfield-e7fd@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9191c2c1a76a759ac97be72481fdd4f9e920c902 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Mon, 2 Nov 2026 15:11:04 +0100 Subject: [PATCH] fuse: fix possible UAF in fuse_direntplus_link() In fuse_direntplus_link() a use-after-free occurs on struct fuse_inode when linking a newly allocated in-lookup dentry during FUSE_READDIRPLUS processing fails inside d_splice_alias(). When d_in_lookup(dentry) is true, fuse_iget() returns an inode with an incremented reference count and fi->nlookup, which is then passed to d_splice_alias(). Inside d_splice_alias_ops(), if the directory inode has an existing alias and splicing fails with -ELOOP in d_ancestor() or -ESTALE in __d_unalias(), the function drops the alias reference via dput(new) and unconditionally consumes the caller's inode reference via iput(inode) before returning the error pointer. If the existing alias is concurrently unhashed and dropped, iput(inode) drops the final inode reference and evicts the inode immediately via fuse_evict_inode(), sending a FUSE_FORGET request for fi->nlookup and freeing struct fuse_inode via RCU. Because fuse_direntplus_link() subsequently checks !IS_ERR(inode) outside an RCU read-side critical section, it dereferences the freed inode to acquire fi->lock and decrement fi->nlookup, and its caller parse_dirplusfile() then invokes fuse_force_forget() on the error return, issuing a duplicate FUSE_FORGET request to the server. Fixes: b8bd342d50cb ("fuse: nlookup missing decrement in fuse_direntplus_link") Cc: stable@vger.kernel.org #v6.6+ Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-0a00a32c-3732-46fe-9cdb-3c67a11903cc Signed-off-by: Miklos Szeredi diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index 295cbd645653..f4f9590f8ae5 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -236,9 +236,13 @@ static int fuse_direntplus_link(struct file *file, inode = fuse_iget(dir->i_sb, o->nodeid, o->generation, &o->attr, ATTR_TIMEOUT(o), attr_version, evict_ctr); - if (!inode) - inode = ERR_PTR(-ENOMEM); + if (!inode) { + d_lookup_done(dentry); + dput(dentry); + return -ENOMEM; + } + ihold(inode); /* d_splice_alias() eats a reference */ alias = d_splice_alias(inode, dentry); d_lookup_done(dentry); if (alias) { @@ -246,15 +250,15 @@ static int fuse_direntplus_link(struct file *file, dentry = alias; } if (IS_ERR(dentry)) { - if (!IS_ERR(inode)) { - struct fuse_inode *fi = get_fuse_inode(inode); + struct fuse_inode *fi = get_fuse_inode(inode); - spin_lock(&fi->lock); - fi->nlookup--; - spin_unlock(&fi->lock); - } + spin_lock(&fi->lock); + fi->nlookup--; + spin_unlock(&fi->lock); + iput(inode); return PTR_ERR(dentry); } + iput(inode); } if (fc->readdirplus_auto) set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state);