Skip to content

Commit 62c2672

Browse files
elfringgregkh
authored andcommitted
NFS: Prevent resource leak in nfs_alloc_server()
commit d189f22 upstream. It was overlooked to call ida_free() after a failed nfs_alloc_iostats() call. Thus add the missed function call in an if branch. Fixes: 1c72511 ("NFS: add superblock sysfs entries") Cc: stable@vger.kernel.org Reported-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr> Closes: https://lore.kernel.org/linux-nfs/1c8e10c9-def7-4f0d-8aa1-23c8035a38c8@wanadoo.fr/ Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6919eb5 commit 62c2672

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/nfs/client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,7 @@ struct nfs_server *nfs_alloc_server(void)
10701070

10711071
server->io_stats = nfs_alloc_iostats();
10721072
if (!server->io_stats) {
1073+
ida_free(&s_sysfs_ids, server->s_sysfs_id);
10731074
kfree(server);
10741075
return NULL;
10751076
}

0 commit comments

Comments
 (0)