Skip to content

Commit

Permalink
udmabuf: put dmabuf in case of get fd failed
Browse files Browse the repository at this point in the history
It needs call dma_buf_put() to put dmabuf in case of getting
fd failed.

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
  • Loading branch information
Xianting Tian authored and intel-lab-lkp committed Dec 20, 2021
1 parent a7904a5 commit 322781a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/dma-buf/udmabuf.c
Expand Up @@ -274,8 +274,11 @@ static long udmabuf_create(struct miscdevice *device,
flags = 0;
if (head->flags & UDMABUF_FLAGS_CLOEXEC)
flags |= O_CLOEXEC;
return dma_buf_fd(buf, flags);
ret = dma_buf_fd(buf, flags);
if (ret < 0) {
dma_buf_put(buf);

return ret;
err:
while (pgbuf > 0)
put_page(ubuf->pages[--pgbuf]);
Expand Down

0 comments on commit 322781a

Please sign in to comment.