• Josh Boyer's avatar
    CacheFiles: Fix memory leak in cachefiles_check_auxdata error paths · 607566ae
    Josh Boyer authored
    In cachefiles_check_auxdata(), we allocate auxbuf but fail to free it if
    we determine there's an error or that the data is stale.
    
    Further, assigning the output of vfs_getxattr() to auxbuf->len gives
    problems with checking for errors as auxbuf->len is a u16.  We don't
    actually need to set auxbuf->len, so keep the length in a variable for
    now.  We shouldn't need to check the upper limit of the buffer as an
    overflow there should be indicated by -ERANGE.
    
    While we're at it, fscache_check_aux() returns an enum value, not an
    int, so assign it to an appropriately typed variable rather than to ret.
    Signed-off-by: default avatarJosh Boyer <jwboyer@fedoraproject.org>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    cc: Hongyi Jia <jiayisuse@gmail.com>
    cc: Milosz Tanski <milosz@adfin.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    607566ae
xattr.c 7.11 KB