aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/symlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/symlink.c')
-rw-r--r--fs/sysfs/symlink.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index d96bb9cbc9d4..c72820450e7c 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -57,14 +57,9 @@ static int sysfs_add_link(struct dentry * parent, const char * name, struct kobj
57 if (!sl) 57 if (!sl)
58 goto err_out; 58 goto err_out;
59 59
60 sl->link_name = kmalloc(strlen(name) + 1, GFP_KERNEL);
61 if (!sl->link_name)
62 goto err_out;
63
64 strcpy(sl->link_name, name);
65 sl->target_kobj = kobject_get(target); 60 sl->target_kobj = kobject_get(target);
66 61
67 sd = sysfs_new_dirent(sl, S_IFLNK|S_IRWXUGO, SYSFS_KOBJ_LINK); 62 sd = sysfs_new_dirent(name, sl, S_IFLNK|S_IRWXUGO, SYSFS_KOBJ_LINK);
68 if (!sd) 63 if (!sd)
69 goto err_out; 64 goto err_out;
70 sysfs_attach_dirent(sd, parent_sd, NULL); 65 sysfs_attach_dirent(sd, parent_sd, NULL);
@@ -74,7 +69,6 @@ static int sysfs_add_link(struct dentry * parent, const char * name, struct kobj
74 err_out: 69 err_out:
75 if (sl) { 70 if (sl) {
76 kobject_put(sl->target_kobj); 71 kobject_put(sl->target_kobj);
77 kfree(sl->link_name);
78 kfree(sl); 72 kfree(sl);
79 } 73 }
80 return error; 74 return error;