[PATCH 1/2] renderonly: close transfer prime_fd

Philipp Zabel p.zabel at pengutronix.de
Thu Apr 27 16:44:01 UTC 2017


prime_fd is only used to transfer the scanout buffer to the GPU inside
renderonly_create_kms_dumb_buffer_for_resource. It should be closed
immediately to avoid leaking the DMA-BUF file handle.

Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
---
 src/gallium/auxiliary/renderonly/renderonly.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c
index 7e23769159..e17c32886d 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -116,6 +116,8 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc,
    scanout->prime = screen->resource_from_handle(screen, rsc,
          &handle, PIPE_HANDLE_USAGE_READ_WRITE);
 
+   close(prime_fd);
+
    if (!scanout->prime) {
       fprintf(stderr, "failed to create resource_from_handle: %s\n", strerror(errno));
       goto free_dumb;
-- 
2.11.0



More information about the etnaviv mailing list