mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
dma-buf/udmabuf: Fix NULL pointer dereference in udmabuf_create
There is a potential execution path in which pointer memfd is NULL when
passed as argument to fput(), hence there is a NULL pointer dereference
in fput().
Fix this by null checking *memfd* before calling fput().
Addresses-Coverity-ID: 1473174 ("Explicit null dereferenced")
Fixes: fbb0de7950 ("Add udmabuf misc device")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20180904190749.GA9308@embeddedor.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
a3b815f09b
commit
683a0e630c
1 changed files with 2 additions and 1 deletions
|
|
@ -194,7 +194,8 @@ err_put_pages:
|
|||
while (pgbuf > 0)
|
||||
put_page(ubuf->pages[--pgbuf]);
|
||||
err_free_ubuf:
|
||||
fput(memfd);
|
||||
if (memfd)
|
||||
fput(memfd);
|
||||
kfree(ubuf->pages);
|
||||
kfree(ubuf);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue