From: Yang Xiuwei Date: Thu, 30 Oct 2025 03:03:25 +0000 (+0800) Subject: NFS: sysfs: fix leak when nfs_client kobject add fails X-Git-Tag: v6.18-rc6~13^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a7a3456520b309a0bffa1d9d62bd6c9dcab89b3;p=thirdparty%2Flinux.git 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: e96f9268eea6 ("NFS: Make all of /sys/fs/nfs network-namespace unique") Signed-off-by: Yang Xiuwei Reviewed-by: Benjamin Coddington Signed-off-by: Anna Schumaker --- diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c index 545148d42dcc9..ea6e6168092b2 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; }