summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2017-08-18 12:04:55 -0700
committerFrancisco Jerez <currojerez@riseup.net>2017-08-22 11:56:38 -0700
commite29ccaac298d04ad4272af2d8b8d7a953c523e28 (patch)
tree2cdc443e5ef23aeac8775944b887c3be60c8f0cd
parent7ca124a6a3987fbfc09bc530761d44714c0da773 (diff)
anv: Check that in_fence fd is valid before closing it.
Probably harmless, but will overwrite errno with a failure status code. Reported by coverity. CID 1416600: Argument cannot be negative (NEGATIVE_RETURNS) Fixes: 5c4e4932e02 (anv: Implement support for exporting semaphores as FENCE_FD) Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
-rw-r--r--src/intel/vulkan/anv_batch_chain.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index 26b5375903..1e7455f71e 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1571,7 +1571,8 @@ anv_cmd_buffer_execbuf(struct anv_device *device,
result = anv_device_execbuf(device, &execbuf.execbuf, execbuf.bos);
/* Execbuf does not consume the in_fence. It's our job to close it. */
- close(in_fence);
+ if (in_fence != -1)
+ close(in_fence);
for (uint32_t i = 0; i < num_in_semaphores; i++) {
ANV_FROM_HANDLE(anv_semaphore, semaphore, in_semaphores[i]);