提交 683a0e63 编写于 作者: G Gustavo A. R. Silva 提交者: Gerd Hoffmann

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: fbb0de79 ("Add udmabuf misc device")
Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20180904190749.GA9308@embeddedor.comSigned-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 a3b815f0
......@@ -194,7 +194,8 @@ static long udmabuf_create(struct udmabuf_create_list *head,
while (pgbuf > 0)
put_page(ubuf->pages[--pgbuf]);
err_free_ubuf:
fput(memfd);
if (memfd)
fput(memfd);
kfree(ubuf->pages);
kfree(ubuf);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册