renderonly: close transfer prime_fd
authorPhilipp Zabel <p.zabel@pengutronix.de>
Thu, 27 Apr 2017 16:44:01 +0000 (18:44 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Tue, 2 May 2017 20:19:19 +0000 (22:19 +0200)
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: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
src/gallium/auxiliary/renderonly/renderonly.c

index 7e23769159df78c6ef1be58d51377bdeb39fa7cb..e17c32886d2883bdc668058b5525d2425fc29328 100644 (file)
@@ -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;