mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
NFS: Fix sysfs server name memory leak
Free the formatted server index string after it has been duplicated by
kobject_rename().
Fixes: 1c7251187d
("NFS: add superblock sysfs entries")
Reported-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
be2fd1560e
commit
c3dd7de2a3
@ -345,8 +345,10 @@ void nfs_sysfs_move_sb_to_server(struct nfs_server *server)
|
||||
int ret = -ENOMEM;
|
||||
|
||||
s = kasprintf(GFP_KERNEL, "server-%d", server->s_sysfs_id);
|
||||
if (s)
|
||||
if (s) {
|
||||
ret = kobject_rename(&server->kobj, s);
|
||||
kfree(s);
|
||||
}
|
||||
if (ret < 0)
|
||||
pr_warn("NFS: rename sysfs %s failed (%d)\n",
|
||||
server->kobj.name, ret);
|
||||
|
Loading…
Reference in New Issue
Block a user