From: Trond Myklebust Date: Thu, 27 Oct 2022 20:50:12 +0000 (-0400) Subject: NFSv4: Fix a credential leak in _nfs4_discover_trunking() X-Git-Tag: v5.15.92~1220 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6aca4c7ba8f6d40a0cfeeb09160dd8efdf97c64;p=platform%2Fkernel%2Flinux-rpi.git NFSv4: Fix a credential leak in _nfs4_discover_trunking() [ Upstream commit e83458fce080dc23c25353a1af90bfecf79c7369 ] Fixes: 4f40a5b55446 ("NFSv4: Add an fattr allocation to _nfs4_discover_trunking()") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index dcc0677..3c9ed63 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -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; @@ -4003,6 +4003,8 @@ out_free_2: kfree(locations); out_free: __free_page(page); +out_put_cred: + put_cred(cred); return status; }