Skip to content

Commit

Permalink
NFSv4: Fix a credential leak in _nfs4_discover_trunking()
Browse files Browse the repository at this point in the history
[ Upstream commit e83458f ]

Fixes: 4f40a5b ("NFSv4: Add an fattr allocation to _nfs4_discover_trunking()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Trond Myklebust authored and gregkh committed Dec 31, 2022
1 parent 7f6607c commit c6aca4c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/nfs/nfs4proc.c
Expand Up @@ -3987,7 +3987,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;
Expand All @@ -4003,6 +4003,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;
}

Expand Down

0 comments on commit c6aca4c

Please sign in to comment.