summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorYang Xiuwei <yangxiuwei@kylinos.cn>2025-10-30 06:03:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-24 12:30:02 +0300
commit0ad6db4438ef32905b6cb01ed9d5f45cfc634eba (patch)
tree86adccd258ab3e2f9aa9f6f28b3a36df124bdd28 /fs/nfs
parentb6137b4906f46804776fb8b57020104cdd812059 (diff)
downloadlinux-0ad6db4438ef32905b6cb01ed9d5f45cfc634eba.tar.xz
NFS: sysfs: fix leak when nfs_client kobject add fails
[ Upstream commit 7a7a3456520b309a0bffa1d9d62bd6c9dcab89b3 ] If adding the second kobject fails, drop both references to avoid sysfs residue and memory leak. Fixes: e96f9268eea6 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/sysfs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
index 784f7c1d003b..53d4cdf28ee0 100644
--- a/fs/nfs/sysfs.c
+++ b/fs/nfs/sysfs.c
@@ -189,6 +189,7 @@ static struct nfs_netns_client *nfs_netns_client_alloc(struct kobject *parent,
return p;
kobject_put(&p->kobject);
+ kobject_put(&p->nfs_net_kobj);
}
return NULL;
}