lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175573318746.4130038.9263918181319561586.stgit@frogsfrogsfrogs>
Date: Wed, 20 Aug 2025 16:42:57 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: [PATCH 08/12] fuse2fs: interpret error codes in remove_ea_inodes
 correctly

From: Darrick J. Wong <djwong@...nel.org>

remove_ea_inodes should translate libext2fs error codes into errnos so
that fs developers can trace exactly where a failure occurred.  Also
don't squash EA inode removal errors.

Cc: <linux-ext4@...r.kernel.org> # v1.47.3
Fixes: 3045aed621117f ("fuse2fs: fix removing ea inodes when freeing a file")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
 misc/fuse2fs.c |   29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)


diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 415f174875922f..a7f7e7f1595344 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -1524,12 +1524,13 @@ static int unlink_file_by_name(struct fuse2fs *ff, const char *path)
 	return update_mtime(fs, dir, NULL);
 }
 
-static errcode_t remove_ea_inodes(struct fuse2fs *ff, ext2_ino_t ino,
-				  struct ext2_inode_large *inode)
+static int remove_ea_inodes(struct fuse2fs *ff, ext2_ino_t ino,
+			    struct ext2_inode_large *inode)
 {
 	ext2_filsys fs = ff->fs;
 	struct ext2_xattr_handle *h;
 	errcode_t err;
+	int ret = 0;
 
 	/*
 	 * The xattr handle maintains its own private copy of the inode, so
@@ -1537,25 +1538,35 @@ static errcode_t remove_ea_inodes(struct fuse2fs *ff, ext2_ino_t ino,
 	 */
 	err = fuse2fs_write_inode(fs, ino, inode);
 	if (err)
-		return err;
+		return translate_error(fs, ino, err);
 
 	err = ext2fs_xattrs_open(fs, ino, &h);
 	if (err)
-		return err;
+		return translate_error(fs, ino, err);
 
 	err = ext2fs_xattrs_read(h);
-	if (err)
+	if (err) {
+		ret = translate_error(fs, ino, err);
 		goto out_close;
+	}
 
 	err = ext2fs_xattr_remove_all(h);
-	if (err)
+	if (err) {
+		ret = translate_error(fs, ino, err);
 		goto out_close;
+	}
 
 out_close:
 	ext2fs_xattrs_close(&h);
+	if (ret)
+		return ret;
 
 	/* Now read the inode back in. */
-	return fuse2fs_read_inode(fs, ino, inode);
+	err = fuse2fs_read_inode(fs, ino, inode);
+	if (err)
+		return translate_error(fs, ino, err);
+
+	return 0;
 }
 
 static int remove_inode(struct fuse2fs *ff, ext2_ino_t ino)
@@ -1592,8 +1603,8 @@ static int remove_inode(struct fuse2fs *ff, ext2_ino_t ino)
 		goto write_out;
 
 	if (ext2fs_has_feature_ea_inode(fs->super)) {
-		err = remove_ea_inodes(ff, ino, &inode);
-		if (err)
+		ret = remove_ea_inodes(ff, ino, &inode);
+		if (ret)
 			goto write_out;
 	}
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ