]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
sysfs: Fix regression when adding a file to an existing group
authorTyler Hicks <tyhicks@canonical.com>
Wed, 31 Oct 2018 00:55:25 +0000 (00:55 +0000)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 9 Nov 2018 18:59:55 +0000 (16:59 -0200)
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@canonical.com>
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Tested-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d1753390274f7760e5b593cb657ea34f0617e559)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Kleber Souza <kleber.souza@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/sysfs/file.c

index 8970b512ecc171027daa853f35f70d32d5fd06ae..fbd090a10fd96b5afde589e780fa3a4fad872f5e 100644 (file)
@@ -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);