[PATCH 9/9] sysfs: Fix regression when adding a file to an existing group
Tyler Hicks
tyhicks at canonical.com
Wed Oct 31 00:55:25 UTC 2018
BugLink: https://launchpad.net/bugs/1784501
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 <tyhicks at canonical.com>
Reported-by: Heiner Kallweit <hkallweit1 at gmail.com>
Tested-by: Heiner Kallweit <hkallweit1 at gmail.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit d1753390274f7760e5b593cb657ea34f0617e559)
Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
---
fs/sysfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 8970b512ecc1..fbd090a10fd9 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -375,7 +375,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);
--
2.7.4
More information about the kernel-team
mailing list