• Joe Perches's avatar
    cifs: check kzalloc return · 0544b324
    Joe Perches authored
    kzalloc can return NULL so an additional check is needed. While there
    is a check for ret_buf there is no check for the allocation of
    ret_buf->crfid.fid - this check is thus added. Both call-sites
    of tconInfoAlloc() check for NULL return of tconInfoAlloc()
    so returning NULL on failure of kzalloc() here seems appropriate.
    As the kzalloc() is the only thing here that can fail it is
    moved to the beginning so as not to initialize other resources
    on failure of kzalloc.
    
    Fixes: 3d4ef9a1 ("smb3: fix redundant opens on root")
    Signed-off-by: default avatarJoe Perches <joe@perches.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    0544b324
misc.c 25.3 KB