mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
NFSv4: fix out path in __nfs4_get_acl_uncached
[ Upstream commitf4e89f1a6d] Another highly rare error case when a page allocating loop (inside __nfs4_get_acl_uncached, this time) is not properly unwound on error. Since pages array is allocated being uninitialized, need to free only lower array indices. NULL checks were useful before commit62a1573fcf("NFSv4 fix acl retrieval over krb5i/krb5p mounts") when the array had been initialized to zero on stack. Found by Linux Verification Center (linuxtesting.org). Fixes:62a1573fcf("NFSv4 fix acl retrieval over krb5i/krb5p mounts") Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4a289d123f
commit
d9aac9cdd6
@@ -5995,9 +5995,8 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf,
|
||||
out_ok:
|
||||
ret = res.acl_len;
|
||||
out_free:
|
||||
for (i = 0; i < npages; i++)
|
||||
if (pages[i])
|
||||
__free_page(pages[i]);
|
||||
while (--i >= 0)
|
||||
__free_page(pages[i]);
|
||||
if (res.acl_scratch)
|
||||
__free_page(res.acl_scratch);
|
||||
kfree(pages);
|
||||
|
||||
Reference in New Issue
Block a user