• Colin Ian King's avatar
    cifs: fix memory leak of an allocated cifs_ntsd structure · cb891e7a
    Colin Ian King authored
    The call to SMB2_queary_acl can allocate memory to pntsd and also
    return a failure via a call to SMB2_query_acl (and then query_info).
    This occurs when query_info allocates the structure and then in
    query_info the call to smb2_validate_and_copy_iov fails. Currently the
    failure just returns without kfree'ing pntsd hence causing a memory
    leak.
    
    Currently, *data is allocated if it's not already pointing to a buffer,
    so it needs to be kfree'd only if was allocated in query_info, so the
    fix adds an allocated flag to track this.  Also set *dlen to zero on
    an error just to be safe since *data is kfree'd.
    
    Also set errno to -ENOMEM if the allocation of *data fails.
    Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    Reviewed-by: default avatarDan Carpener <dan.carpenter@oracle.com>
    cb891e7a
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
asn1.c Loading commit data...
cache.c Loading commit data...
cifs_debug.c Loading commit data...
cifs_debug.h Loading commit data...
cifs_dfs_ref.c Loading commit data...
cifs_fs_sb.h Loading commit data...
cifs_ioctl.h Loading commit data...
cifs_spnego.c Loading commit data...
cifs_spnego.h Loading commit data...
cifs_unicode.c Loading commit data...
cifs_unicode.h Loading commit data...
cifs_uniupr.h Loading commit data...
cifsacl.c Loading commit data...
cifsacl.h Loading commit data...
cifsencrypt.c Loading commit data...
cifsfs.c Loading commit data...
cifsfs.h Loading commit data...
cifsglob.h Loading commit data...
cifspdu.h Loading commit data...
cifsproto.h Loading commit data...
cifssmb.c Loading commit data...
connect.c Loading commit data...
dfs_cache.c Loading commit data...
dfs_cache.h Loading commit data...
dir.c Loading commit data...
dns_resolve.c Loading commit data...
dns_resolve.h Loading commit data...
export.c Loading commit data...
file.c Loading commit data...
fscache.c Loading commit data...
fscache.h Loading commit data...
inode.c Loading commit data...
ioctl.c Loading commit data...
link.c Loading commit data...
misc.c Loading commit data...
netmisc.c Loading commit data...
nterr.c Loading commit data...
nterr.h Loading commit data...
ntlmssp.h Loading commit data...
readdir.c Loading commit data...
rfc1002pdu.h Loading commit data...
sess.c Loading commit data...
smb1ops.c Loading commit data...
smb2file.c Loading commit data...
smb2glob.h Loading commit data...
smb2inode.c Loading commit data...
smb2maperror.c Loading commit data...
smb2misc.c Loading commit data...
smb2ops.c Loading commit data...
smb2pdu.c Loading commit data...
smb2pdu.h Loading commit data...
smb2proto.h Loading commit data...
smb2status.h Loading commit data...
smb2transport.c Loading commit data...
smbdirect.c Loading commit data...
smbdirect.h Loading commit data...
smbencrypt.c Loading commit data...
smberr.h Loading commit data...
smbfsctl.h Loading commit data...
trace.c Loading commit data...
trace.h Loading commit data...
transport.c Loading commit data...
winucase.c Loading commit data...
xattr.c Loading commit data...