diff options
| author | Yang Xiuwei <yangxiuwei@kylinos.cn> | 2025-10-30 11:03:25 +0800 |
|---|---|---|
| committer | Anna Schumaker <anna.schumaker@oracle.com> | 2025-11-10 14:30:45 -0500 |
| commit | 7a7a3456520b309a0bffa1d9d62bd6c9dcab89b3 (patch) | |
| tree | 5abe73523f554fafb9a515d311406e5391dec987 /fs/nfs/sysfs.c | |
| parent | 85d2c2392ac6348e1171d627497034a341a250c1 (diff) | |
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 <yangxiuwei@kylinos.cn>
Reviewed-by: Benjamin Coddington <ben.coddington@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Diffstat (limited to 'fs/nfs/sysfs.c')
| -rw-r--r-- | fs/nfs/sysfs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c index 545148d42dcc..ea6e6168092b 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; } |