From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=89.108.82.222 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796132160; b=tjRlJnLwROly9sJ5biwMur0At/uyK3y3LWB0oqD2EVyN/dZaVySA0frYgBuP3saoO7aA 2s0XE1Edz3GcHj6JFdTu88heOivJgxV4ZpCG2+YuG2NQqBh8Hy030QLqdP5VhLAjd0341 rPQrEdZqR2wDG1WvdfvOBB3u8gkuD8SEZihhRG2P3wLnkq/mKSa0ajHD7fJQjga02ktW0 YzHeFSn9NSsYAMwyw7zCOX6+GCNVp16qZJ6Gd92HURKEVb5mX9EnMfdv2USXnP4klE/iA sY+3mCdRUIyq9w1sMsyREYj+61M2p6KHq4iGIRK9tgsNOG/mNXiXKCQTdetcTwYsm7g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796132160; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:In-Reply-To: References:From:Date:Subject:To:Cc; bh=SoNyI3f9mxcwXcy3oSTdzkRs/PCtzNAZajMIx+ewRmQ=; b=3wiHD9CPCGMgif6rec8hlO6kPUro/EtG+L5yN7fdJtyn4wIo3A0dqsjduIkV3ssCFDW7 4eKiR4qbI2chBBM+PZFoqyf+IUugcw/glj+m0OxcQTJJuxPYRpB9ZWPaJQLkzJKqOAUqR l7zL7VTNKFwaSPm+Ti0L9/Hqxk2pdSMxkufT8smQo21dRrYRV/54U/bVojK9nzjxUi0Iv bgEWdof3Fadmlp2iH8/FdnhxMkfjXSgZJ02HHphf9E/KwfUgwNRJ4y6XZ0s3BcNf1ZrGB djPh6MQyGNNDy0MqizeXPwnUu61ITKs4CvWRF2FP6LB/EqHgJtxBHFgWf3Wk4+q5VEA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=massivetech.ru; spf=pass smtp.mailfrom=massivetech.ru; dkim=pass header.d=massivetech.ru header.i=@massivetech.ru header.a=rsa-sha256 header.s=dkim header.b=omG0wX9R; arc=none smtp.remote-ip=89.108.82.222 Received: from mail.shopvds.ru (mail.shopvds.ru [89.108.82.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A74A606A33D; Tue, 1 Dec 2026 13:35:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4A74A606A33D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=massivetech.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=massivetech.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=massivetech.ru header.i=@massivetech.ru header.a=rsa-sha256 header.s=dkim header.b=omG0wX9R DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=massivetech.ru; s=dkim; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-ID:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SoNyI3f9mxcwXcy3oSTdzkRs/PCtzNAZajMIx+ewRmQ=; b=omG0wX9RG/HU22+JsKLzWFtybJ +FihDn/go8cOI2MmTS5eSfEBU6h/sCM4vE9PaeU3s2zi4FLL/X/vfHIx4/KSVoiFbNyZNwo0drHsC E1PDi3p3a2HQ9bsS3QeESY9fFFBy6VRa8QepDRHElBiQfupaoB9LzhxLzaAye0oExnvlYy1hGYUxt xIm0DolseF7rhB1sBWLqaxhIIA76i9R9fONbjToN4gjBbTPJhTsrh6wiu3GIDxlTzCN2V/1kMMMya FygvfvLqDcJyiwP3atwDTNLL5FySXKnGIw+1/wPBsqvsbTuNJSOvMwh3cXVDroXyXRJqwRLFMhL0U KqiO7sAg==; Received: from root by panel.shopvds.ru with local (Exim 4.97) (envelope-from ) id 1xYO0Q-0000000FxHk-1AH5; Tue, 01 Dec 2026 16:34:50 +0300 Message-ID: <1247f80c5e87c61d8a9ee865358106c82f63c498.1796132090.git.info@massivetech.ru> In-Reply-To: References: From: Konstantin Adzer Date: Tue, 1 Dec 2026 16:06:09 +0300 Subject: [PATCH 1/3] fuse: return ERR_PTR() from fuse_iget() To: Alexander Viro , Christian Brauner Cc: Jonathan Corbet , Shuah Khan , Randy Dunlap , Dan Williams , Vishal Verma , Dave Jiang , Alison Schofield , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Sterba , David Howells , Marc Dionne , Luis de Bethencourt , Salah Triki , Chris Mason , Ilya Dryomov , Alex Markuze , Xiubo Li , Viacheslav Dubeyko , Jan Harkes , coda@cs.cmu.edu, Nicolas Pitre , Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jingbo Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , Jan Kara , "Theodore Ts'o" , Andreas Dilger , Baokun Li , Ojaswin Mujoo , "Ritesh Harjani (IBM)" , Zhang Yi , Jaegeuk Kim , Miklos Szeredi , Andreas Gruenbacher , John Paul Adrian Glaubitz , Yangtao Li , Richard Weinberger , Anton Ivanov , Johannes Berg , Mikulas Patocka , David Woodhouse , Dave Kleikamp , Greg Kroah-Hartman , Tejun Heo , Trond Myklebust , Anna Schumaker , Ryusuke Konishi , Namjae Jeon , Hyunchul Lee , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Heming Zhao , Mike Marshall , Martin Brandenburg , Amir Goldstein , Anders Larsen , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Phillip Lougher , Zhihao Cheng , Jori Koolstra , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Johannes Weiner , "Michal Koutný" , linux-doc@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, fuse-devel@lists.linux.dev, gfs2@lists.linux.dev, linux-um@lists.infradead.org, linux-mtd@lists.infradead.org, jfs-discussion@lists.sourceforge.net, driver-core@lists.linux.dev, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, ntfs@lists.linux.dev, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-unionfs@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, cgroups@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list fuse_iget() returns NULL on any failure, and its callers turn that into -ENOMEM. Return ERR_PTR(-ENOMEM) instead and pass the error on in the callers, so that fuse_iget() can forward the error of iget5_locked() once that returns ERR_PTR(). No functional change. Signed-off-by: Konstantin Adzer --- fs/fuse/dir.c | 13 +++++++------ fs/fuse/inode.c | 14 +++++++++----- fs/fuse/readdir.c | 4 ++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index a04d93d5fc44..e6bf99b76993 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -599,8 +599,9 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name *inode = fuse_iget(sb, outarg->nodeid, outarg->generation, &outarg->attr, ATTR_TIMEOUT(outarg), attr_version, evict_ctr); - err = -ENOMEM; - if (!*inode) { + if (IS_ERR(*inode)) { + err = PTR_ERR(*inode); + *inode = NULL; fuse_chan_queue_forget(fm->fc->chan, forget, outarg->nodeid, 1); goto out; } @@ -903,11 +904,11 @@ static int fuse_create_open(const struct mnt_idmap *idmap, struct inode *dir, ff->open_flags = outopenp->open_flags; inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, &outentry.attr, ATTR_TIMEOUT(&outentry), 0, 0); - if (!inode) { + if (IS_ERR(inode)) { flags &= ~(O_CREAT | O_EXCL | O_TRUNC); fuse_sync_release(NULL, ff, flags); fuse_chan_queue_forget(fm->fc->chan, forget, outentry.nodeid, 1); - err = -ENOMEM; + err = PTR_ERR(inode); goto out_err; } kfree(forget); @@ -1030,9 +1031,9 @@ static struct dentry *create_new_entry(const struct mnt_idmap *idmap, struct fus inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, &outarg.attr, ATTR_TIMEOUT(&outarg), 0, 0); - if (!inode) { + if (IS_ERR(inode)) { fuse_chan_queue_forget(fm->fc->chan, forget, outarg.nodeid, 1); - return ERR_PTR(-ENOMEM); + return ERR_CAST(inode); } fuse_dentry_set_epoch(entry, epoch); kfree(forget); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 399e5b28c111..23a4bbf5dfa0 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -498,7 +498,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, inode = new_inode(sb); if (!inode) - return NULL; + return ERR_PTR(-ENOMEM); fuse_init_inode(inode, attr, fc); fi = get_fuse_inode(inode); @@ -506,7 +506,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, fi->submount_lookup = fuse_alloc_submount_lookup(); if (!fi->submount_lookup) { iput(inode); - return NULL; + return ERR_PTR(-ENOMEM); } /* Sets nlookup = 1 on fi->submount_lookup->nlookup */ fuse_init_submount_lookup(fi->submount_lookup, nodeid); @@ -517,7 +517,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, retry: inode = iget5_locked(sb, nodeid, fuse_inode_eq, fuse_inode_set, &nodeid); if (!inode) - return NULL; + return ERR_PTR(-ENOMEM); is_new_inode = inode_state_read_once(inode) & I_NEW; if (is_new_inode) { @@ -1716,8 +1716,8 @@ static int fuse_fill_super_submount(struct super_block *sb, fuse_fill_attr_from_inode(&root_attr, parent_fi); root = fuse_iget(sb, parent_fi->nodeid, 0, &root_attr, 0, 0, fuse_get_evict_ctr(fm->fc)); - if (!root) - return -ENOMEM; + if (IS_ERR(root)) + return PTR_ERR(root); /* * This inode is just a duplicate, so it is not looked up and * its nlookup should not be incremented. fuse_iget() does @@ -1858,6 +1858,10 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx) err = -ENOMEM; root = fuse_get_root_inode(sb, ctx->rootmode); + if (IS_ERR(root)) { + err = PTR_ERR(root); + goto err_free_vdax; + } set_default_d_op(sb, &fuse_dentry_operations); root_dentry = d_make_root(root); if (!root_dentry) diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index c1e2a8fd834e..880b489ec42c 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -239,10 +239,10 @@ 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) { + if (IS_ERR(inode)) { d_lookup_done(dentry); dput(dentry); - return -ENOMEM; + return PTR_ERR(inode); } fuse_dentry_set_epoch(dentry, epoch); -- 2.56.1