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=1796133257; b=gv0erBdEzQgMnlFgnPgAXtT34IdWJ5yvqlZDNquDr7oN5UMna9zi0DeyNHcWkUdGxU+6 BS0b5WHoxDql/yX+1roO4ewH6rwEADUXOxnirp2/xFRFwXsEB1NKhEJnmxEHoAf8r/7ev c/UpmB2eEnescoNKT3TxjaJKTnl9YXXcJnYoj07ttU65Iv0MxzE3ZRLmwqQg6C+9OwADT l6LWmIOv5dyUWsf3IHwmC/JAFkjG08BdUjqUWl8UQMip5b82Zlp8/OdMHBssweCxBxQ+o FWgVNT2LVU+NVgx6wQEj7aGHIDqh1O7WCyktrNWDEJiuYX5lFIacBICr+Urm/tKKyZA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133257; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=4WvA8mf1z/D+jPBbEyANTQ7dOf+rAHqE2CYU0smuugY=; b=1wQl2+Qo/Vuh4ZOJyIu9xGfM5/o2jXiW/1R2fXyMuQfG16Zu6+G0gIVqKwx+oH5G0ti4 1ETmw4YbS/YrMrQqK+ouzvpi2QOJtxdAYtujD3NRrVX9ylg99cc7DRmdO9qYEhBJQ2lo0 EHm2i3zHeZaapBLE5LS547/u7jB4FDaJdOFYJtyzjwUO+uu2Oep0zq8VsjJvZ0+T774LA PwMuQWN1RXGDT43e5t3lbgp9gPezAVSxch2Nf+jJW7Rk8y8BlC+r2haLIYRMmvktuF7Gj xF3TlygdUXqSoaTnFahL8p+vhD054UrTU2OJ8d+PeJXKnnWuhdW5mVywsqluhnU7RAw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qgc7QJ3Q; 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 79E29606A320; Tue, 1 Dec 2026 13:54:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qgc7QJ3Q Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA04C1F0089B; Tue, 1 Dec 2026 13:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796133257; bh=4WvA8mf1z/D+jPBbEyANTQ7dOf+rAHqE2CYU0smuugY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Qgc7QJ3Q3njY5YKUu1XCuVrv/EENTkIfOFxZL34o2ICg18oUdpSxQznq7uL3kz2wM ISJA6+oNyqumag8qbt0wlCa45NcSGFEmmVbJufzcsgPVLdiXZzOon/Ha98HFhMlriG tFw3N5V/71rxDUYdbED2L0WfFl/kwZrxiHx/aGap+1hYgubahJj9/zdendxEY1wmuc WiyXiOSJy/iT0bX81apxK5QLUw7wvu+SCtJBMNlVnhApRtet9KnjwNDcnurUPljo7l ce7OOjhW9ZVyVzLSKZywwjS8jLfNaJOeXK3+kgi1321jP27gMzvPiwYJZLBjkRKDZy 6nPQn/iCm9tow== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 3/3] fs: return ERR_PTR() from iget_locked() and friends Reply-To: sashiko-reviews@lists.linux.dev To: "Konstantin Adzer" , "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" , =?utf-8?b?VGhl?= =?utf-8?b?b2RvcmUgVHMnbw==?= , "Andreas Dilger" , "Baokun Li" , "Ojaswin Mujoo" , =?utf-8?b?Uml0ZXNoIEhhcmphbmkgKElCTSk=?= , "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" , =?utf-8?b?TWljaGFsIEtvdXRuw70=?= , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, v9fs@lists.linux.dev, codalist@coda.cs.cmu.edu, linux-ext4@vger.kernel.org, gfs2@lists.linux.dev, linux-mtd@lists.infradead.org, devel@lists.orangefs.org, samba-technical@lists.samba.org, dsterba@suse.cz, "Chuck Lever" , "Jeff Layton" In-Reply-To: <367d7105e3efbc364ff4feb2facd723ad5ab0cc3.1796132090.git.info@massivetech.ru> References: <367d7105e3efbc364ff4feb2facd723ad5ab0cc3.1796132090.git.info@massivetech.ru> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 13:54:13 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 2 related pre-existing issues it does not introduce: - [High] isofs: missing error code in out_toomany path of isofs_read_level3_size() [1] - [High] ufs: division-by-zero in ufs_iget() [2] -- commit adb88fb457bfb90375b2b0cdbe62297aa9ce6146 Author: Konstantin Adzer fs: return ERR_PTR() from iget_locked() and friends This commit changes iget_locked(), iget5_locked(), iget5_locked_rcu(), and inode_insert5() to return an ERR_PTR() instead of NULL on failure, and updates their callers across the tree to check IS_ERR(). [ ... ] > diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c > index 4824e42995ccf..47212eed8269f 100644 > --- a/fs/isofs/inode.c > +++ b/fs/isofs/inode.c > @@ -1504,8 +1504,8 @@ struct inode *__isofs_iget(struct super_block *sb, > inode =3D iget5_locked(sb, hashval, &isofs_iget5_test, > &isofs_iget5_set, &data); > =20 > - if (!inode) > - return ERR_PTR(-ENOMEM); > + if (IS_ERR(inode)) > + return inode; > =20 > if (inode_state_read_once(inode) & I_NEW) { > ret =3D isofs_read_inode(inode, relocated); [Severity: High] This problem wasn't introduced by this patch, but can isofs_read_level3_size() return 0 on the out_toomany error path when called from isofs_read_inode() [1]? fs/isofs/inode.c:isofs_read_level3_size() { ... i++; if (i > 100) goto out_toomany; } while (more_entries); out: kfree(tmpde); brelse(bh); return 0; ... out_toomany: printk(KERN_INFO "%s: More than 100 file sections ?!?, aborting...\n" "isofs_read_level3_size: inode=3D%llu\n", __func__, inode->i_ino); goto out; } When an image has a file with more than 100 sections, out_toomany jumps to out and returns 0, so isofs_read_inode() treats the malformed inode as valid and unlocks it with truncated size. [ ... ] > diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c > index fec701330d67f..9d00e75c8fab2 100644 > --- a/fs/ufs/inode.c > +++ b/fs/ufs/inode.c > @@ -653,8 +653,8 @@ struct inode *ufs_iget(struct super_block *sb, unsign= ed long ino) > } > =20 > inode =3D iget_locked(sb, ino); > - if (!inode) > - return ERR_PTR(-ENOMEM); > + if (IS_ERR(inode)) > + return inode; > if (!(inode_state_read_once(inode) & I_NEW)) > return inode; > =20 [Severity: High] This problem wasn't introduced by this patch, but can ufs_inotofsba() divide by zero right after this check when mounting a corrupted UFS image [2]? fs/ufs/inode.c:ufs_iget() { ... ufsi =3D UFS_I(inode); bh =3D sb_bread(sb, uspi->s_sbbase + ufs_inotofsba(inode->i_ino)); } fs/ufs/ufs_fs.h: #define ufs_inotocg(x) ((unsigned int)(x) / uspi->s_ipg) #define ufs_inotocgoff(x) ((unsigned int)(x) % uspi->s_ipg) #define ufs_inotofsba(x) (((u64)ufs_cgimin(ufs_inotocg(x))) + ufs_inotocgof= f(x) / uspi->s_inopf) ufs_fill_super() populates uspi->s_ipg and uspi->s_inopf from the on-disk superblock without checking that they are non-zero, so loading the root inode in ufs_iget() triggers a divide error if either field is zero. [1] https://sashiko.dev/#/bug/linux-03286deb-aa65-44af-9d0a-7ac38844847c [2] https://sashiko.dev/#/bug/linux-6bde18a6-cee5-4787-b073-9e622fcafcd9 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796132090.gi= t.info@massivetech.ru?part=3D3