[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211220054333.3041893-1-xianting.tian@linux.alibaba.com>
Date: Mon, 20 Dec 2021 13:43:33 +0800
From: Xianting Tian <xianting.tian@...ux.alibaba.com>
To: kraxel@...hat.com, sumit.semwal@...aro.org,
christian.koenig@....com
Cc: dri-devel@...ts.freedesktop.org, linux-media@...r.kernel.org,
linaro-mm-sig@...ts.linaro.org, linux-kernel@...r.kernel.org,
Xianting Tian <xianting.tian@...ux.alibaba.com>
Subject: [PATCH] udmabuf: put dmabuf in case of get fd failed
It needs call dma_buf_put() to put dmabuf in case of getting
fd failed.
Signed-off-by: Xianting Tian <xianting.tian@...ux.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
Powered by blists - more mailing lists