diff mbox series

NFSv4: Fix a credential leak in _nfs4_discover_trunking()

Message ID 20221029025119.10104-1-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series NFSv4: Fix a credential leak in _nfs4_discover_trunking() | expand

Commit Message

Trond Myklebust Oct. 29, 2022, 2:51 a.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

Fixes: 4f40a5b55446 ("NFSv4: Add an fattr allocation to _nfs4_discover_trunking()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4proc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0ae48498c174..69d78d2c1c20 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4017,7 +4017,7 @@  static int _nfs4_discover_trunking(struct nfs_server *server,
 
 	page = alloc_page(GFP_KERNEL);
 	if (!page)
-		return -ENOMEM;
+		goto out_put_cred;
 	locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL);
 	if (!locations)
 		goto out_free;
@@ -4039,6 +4039,8 @@  static int _nfs4_discover_trunking(struct nfs_server *server,
 	kfree(locations);
 out_free:
 	__free_page(page);
+out_put_cred:
+	put_cred(cred);
 	return status;
 }