From ab51cd2f26496500d52f6b2847291d884f711bc2 Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Thu, 27 Apr 2017 18:44:01 +0200
Subject: [PATCH] renderonly: close transfer prime_fd
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.
Fixes: 848b49b288f ("gallium: add renderonly library")
CC:
Signed-off-by: Philipp Zabel
Reviewed-by: Emil Velikov
Reviewed-by: Christian Gmeiner
---
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 7e23769..e17c328 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.7.4