• J
    cifs: check kzalloc return · f65f9a50
    Joe Perches 提交于
    mainline inclusion
    from mainline-5.0
    commit 0544b324e62c
    category: bugfix
    bugzilla: 5840
    CVE: NA
    
    -------------------------------------------------
    
    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")
    
    conflict:
    	fs/cifs/misc.c
    由于未合入 fae8044c03 smb3: show number of current open files in
    /proc/fs/cifs/Stats,导致冲突
    Signed-off-by: NJoe Perches <joe@perches.com>
    Signed-off-by: NSteve French <stfrench@microsoft.com>
    Signed-off-by: NZhangXiaoxu <zhangxiaoxu5@huawei.com>
    Reviewed-by: NMiao Xie <miaoxie@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    f65f9a50
misc.c 25.0 KB