]> Git Repo - linux.git/commitdiff
NFSv4: fix out path in __nfs4_get_acl_uncached
authorFedor Pchelkin <[email protected]>
Tue, 25 Jul 2023 11:59:30 +0000 (14:59 +0300)
committerTrond Myklebust <[email protected]>
Sat, 19 Aug 2023 14:26:29 +0000 (10:26 -0400)
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 commit 62a1573fcf84
("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: 62a1573fcf84 ("NFSv4 fix acl retrieval over krb5i/krb5p mounts")
Signed-off-by: Fedor Pchelkin <[email protected]>
Reviewed-by: Benjamin Coddington <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
fs/nfs/nfs4proc.c

index 4604e9f3d1b01c475a559f65fa4739a475f84fd8..832fa226b8f2689538549169f208779b6d69d1c6 100644 (file)
@@ -6004,9 +6004,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);
This page took 0.069778 seconds and 4 git commands to generate.