All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] udmabuf: put dmabuf in case of get fd failed
@ 2021-12-20  5:43 ` Xianting Tian
  0 siblings, 0 replies; 11+ messages in thread
From: Xianting Tian @ 2021-12-20  5:43 UTC (permalink / raw)
  To: kraxel, sumit.semwal, christian.koenig
  Cc: dri-devel, linux-media, linaro-mm-sig, linux-kernel, Xianting Tian

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>
---
 drivers/dma-buf/udmabuf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index c57a609db..d77f96995 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -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]);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-20 14:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20  5:43 [PATCH] udmabuf: put dmabuf in case of get fd failed Xianting Tian
2021-12-20  5:43 ` Xianting Tian
2021-12-20 13:20 ` kernel test robot
2021-12-20 13:20   ` kernel test robot
2021-12-20 13:20   ` kernel test robot
2021-12-20 13:41 ` kernel test robot
2021-12-20 13:41   ` kernel test robot
2021-12-20 13:41   ` kernel test robot
2021-12-20 14:06 ` kernel test robot
2021-12-20 14:06   ` kernel test robot
2021-12-20 14:06   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.