]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: check kzalloc return
authorJoe Perches <joe@perches.com>
Fri, 21 Dec 2018 05:50:48 +0000 (23:50 -0600)
committerSteve French <stfrench@microsoft.com>
Fri, 28 Dec 2018 16:09:46 +0000 (10:09 -0600)
commit2312016285f03132fa7f3b4aba83326f6b5d0037
tree889b401a257a882a6a4882192b8726e75c87677b
parent01ca19686ce2383eccccb0d45109a6705c5ec418
cifs: check kzalloc return

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: b551adb1d85d ("smb3: fix redundant opens on root")
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/misc.c