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: <176602332570.688213.9854057917443661154.stgit@frogsfrogsfrogs>
Date: Wed, 17 Dec 2025 18:05:01 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: brauner@...nel.org, djwong@...nel.org
Cc: linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org, hch@....de,
 linux-fsdevel@...r.kernel.org
Subject: [PATCH 3/4] ext4: convert ext4_root to a kset

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

In the next patch, we'll enhance ext4 to send uevents when significant
filesystem mount events occur (remounting, shutdown, unmount, etc.)
However, kobject_uevent_env requires that the filesystem's kobject be a
member of a kset.  Therefore, change ext4_root to ext4_kset and migrate
the two users of it.

Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
 fs/ext4/sysfs.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)


diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 0018e09b867ec3..e6a14585244308 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -564,7 +564,7 @@ void ext4_notify_error_sysfs(struct ext4_sb_info *sbi)
 	sysfs_notify(&sbi->s_kobj, NULL, "errors_count");
 }
 
-static struct kobject *ext4_root;
+static struct kset *ext4_kset;
 
 static struct kobject *ext4_feat;
 
@@ -574,7 +574,8 @@ int ext4_register_sysfs(struct super_block *sb)
 	int err;
 
 	init_completion(&sbi->s_kobj_unregister);
-	err = kobject_init_and_add(&sbi->s_kobj, &ext4_sb_ktype, ext4_root,
+	sbi->s_kobj.kset = ext4_kset;
+	err = kobject_init_and_add(&sbi->s_kobj, &ext4_sb_ktype, NULL,
 				   "%s", sb->s_id);
 	if (err) {
 		kobject_put(&sbi->s_kobj);
@@ -615,8 +616,8 @@ int __init ext4_init_sysfs(void)
 {
 	int ret;
 
-	ext4_root = kobject_create_and_add("ext4", fs_kobj);
-	if (!ext4_root)
+	ext4_kset = kset_create_and_add("ext4", NULL, fs_kobj);
+	if (!ext4_kset)
 		return -ENOMEM;
 
 	ext4_feat = kzalloc(sizeof(*ext4_feat), GFP_KERNEL);
@@ -625,8 +626,9 @@ int __init ext4_init_sysfs(void)
 		goto root_err;
 	}
 
+	ext4_feat->kset = ext4_kset;
 	ret = kobject_init_and_add(ext4_feat, &ext4_feat_ktype,
-				   ext4_root, "features");
+				   NULL, "features");
 	if (ret)
 		goto feat_err;
 
@@ -637,8 +639,8 @@ int __init ext4_init_sysfs(void)
 	kobject_put(ext4_feat);
 	ext4_feat = NULL;
 root_err:
-	kobject_put(ext4_root);
-	ext4_root = NULL;
+	kset_unregister(ext4_kset);
+	ext4_kset = NULL;
 	return ret;
 }
 
@@ -646,8 +648,8 @@ void ext4_exit_sysfs(void)
 {
 	kobject_put(ext4_feat);
 	ext4_feat = NULL;
-	kobject_put(ext4_root);
-	ext4_root = NULL;
+	kset_unregister(ext4_kset);
+	ext4_kset = NULL;
 	remove_proc_entry(proc_dirname, NULL);
 	ext4_proc_root = NULL;
 }


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ