From d1753390274f7760e5b593cb657ea34f0617e559 Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Fri, 27 Jul 2018 21:33:27 +0000 Subject: sysfs: Fix regression when adding a file to an existing group Commit 5f81880d5204 ("sysfs, kobject: allow creating kobject belonging to arbitrary users") incorrectly changed the argument passed as the parent parameter when calling sysfs_add_file_mode_ns(). This caused some sysfs attribute files to not be added correctly to certain groups. Fixes: 5f81880d5204 ("sysfs, kobject: allow creating kobject belonging to arbitrary users") Signed-off-by: Tyler Hicks Reported-by: Heiner Kallweit Tested-by: Heiner Kallweit Signed-off-by: David S. Miller --- fs/sysfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index fa46216523cf..052e5ad9a4d2 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -373,7 +373,7 @@ int sysfs_add_file_to_group(struct kobject *kobj, return -ENOENT; kobject_get_ownership(kobj, &uid, &gid); - error = sysfs_add_file_mode_ns(kobj->sd, attr, false, + error = sysfs_add_file_mode_ns(parent, attr, false, attr->mode, uid, gid, NULL); kernfs_put(parent); -- cgit v1.2.3-59-g8ed1b