]> git.hungrycats.org Git - linux/commitdiff
NFSv4: Fix memory leak in nfs4_set_security_label
authorDmitry Mastykin <mastichi@gmail.com>
Wed, 22 May 2024 07:45:24 +0000 (10:45 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jul 2024 07:53:25 +0000 (09:53 +0200)
[ Upstream commit aad11473f8f4be3df86461081ce35ec5b145ba68 ]

We leak nfs_fattr and nfs4_label every time we set a security xattr.

Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs4proc.c

index 3a816c4a6d5e2ad9e2324081b9b3e374476a15f8..a691fa10b3e95f63ce810ea149410bb41dfd840e 100644 (file)
@@ -6289,6 +6289,7 @@ nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen)
        if (status == 0)
                nfs_setsecurity(inode, fattr);
 
+       nfs_free_fattr(fattr);
        return status;
 }
 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */