]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sysfs: Use local reference in compat_only_sysfs_link_entry_to_kobj()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Wed, 14 Jul 2021 15:15:59 +0000 (17:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Jul 2021 14:11:42 +0000 (16:11 +0200)
As we have just obtained target_kobj->sd into a local variable, and
incremented the object's reference count, it is better to use the local
variable instead of the original reference.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20210714151559.2532572-1-geert@linux-m68k.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/sysfs/group.c

index 64e6a6698935e9254bf789bb570e8e0559a4cfce..f29d6200452725d4a6033e17a41429b0bc203cc5 100644 (file)
@@ -446,7 +446,7 @@ int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
        if (!target)
                return -ENOENT;
 
-       entry = kernfs_find_and_get(target_kobj->sd, target_name);
+       entry = kernfs_find_and_get(target, target_name);
        if (!entry) {
                kernfs_put(target);
                return -ENOENT;