Commit 7a7a3456 authored by Yang Xiuwei's avatar Yang Xiuwei Committed by Anna Schumaker
Browse files

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: e96f9268 ("NFS: Make all of /sys/fs/nfs network-namespace unique")

Signed-off-by: default avatarYang Xiuwei <yangxiuwei@kylinos.cn>
Reviewed-by: default avatarBenjamin Coddington <ben.coddington@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <anna.schumaker@oracle.com>
parent 85d2c239
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
}