Skip to content

Commit 7fe9ed6

Browse files
Yang Xiuweirva3
authored andcommitted
NFS: sysfs: fix leak when nfs_client kobject add fails
If adding the second kobject fails, drop both references to avoid sysfs residue and memory leak. Fixes: e96f926 ("NFS: Make all of /sys/fs/nfs network-namespace unique") Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn> Reviewed-by: Benjamin Coddington <ben.coddington@hammerspace.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
1 parent f330d55 commit 7fe9ed6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/nfs/sysfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ static struct nfs_netns_client *nfs_netns_client_alloc(struct kobject *parent,
189189
return p;
190190

191191
kobject_put(&p->kobject);
192+
kobject_put(&p->nfs_net_kobj);
192193
}
193194
return NULL;
194195
}

0 commit comments

Comments
 (0)