From: Xianting Tian <xianting.tian@linux.alibaba.com> To: kraxel@redhat.com, sumit.semwal@linaro.org, christian.koenig@amd.com Cc: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Xianting Tian <xianting.tian@linux.alibaba.com> Subject: [PATCH] udmabuf: put dmabuf in case of get fd failed Date: Mon, 20 Dec 2021 13:43:33 +0800 [thread overview] Message-ID: <20211220054333.3041893-1-xianting.tian@linux.alibaba.com> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: Xianting Tian <xianting.tian@linux.alibaba.com> To: kraxel@redhat.com, sumit.semwal@linaro.org, christian.koenig@amd.com Cc: linaro-mm-sig@lists.linaro.org, Xianting Tian <xianting.tian@linux.alibaba.com>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org Subject: [PATCH] udmabuf: put dmabuf in case of get fd failed Date: Mon, 20 Dec 2021 13:43:33 +0800 [thread overview] Message-ID: <20211220054333.3041893-1-xianting.tian@linux.alibaba.com> (raw) 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
next reply other threads:[~2021-12-20 5:43 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-20 5:43 Xianting Tian [this message] 2021-12-20 5:43 ` [PATCH] udmabuf: put dmabuf in case of get fd failed 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211220054333.3041893-1-xianting.tian@linux.alibaba.com \ --to=xianting.tian@linux.alibaba.com \ --cc=christian.koenig@amd.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=kraxel@redhat.com \ --cc=linaro-mm-sig@lists.linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=sumit.semwal@linaro.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.