]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
NFS: Prevent resource leak in nfs_alloc_server()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 14 Jun 2026 07:56:35 +0000 (09:56 +0200)
committerAnna Schumaker <anna.schumaker@hammerspace.com>
Wed, 17 Jun 2026 18:07:09 +0000 (14:07 -0400)
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: 1c7251187dc067a6d460cf33ca67da9c1dd87807 ("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>
fs/nfs/client.c

index be02bb227741d57aea784920ab94fecb548b077e..0781b15e7e05c00be8db456527b2ecfcbecebd33 100644 (file)
@@ -1074,6 +1074,7 @@ struct nfs_server *nfs_alloc_server(void)
 
        server->io_stats = nfs_alloc_iostats();
        if (!server->io_stats) {
+               ida_free(&s_sysfs_ids, server->s_sysfs_id);
                kfree(server);
                return NULL;
        }