omap: Initialize DMA BUF file descriptor to -1
Commitmainc86dabfc9f
("omap: zero is a valid fd number, treat it as such") corrected checks for valid file descriptors, but the OMAP buffer object code initializes the DMA-BUF file descriptor to 0 (as a result of calloc()'ing the structure). Obviously this isn't going to work because subsequent code will try to use file descriptor 0 (most likely stdin at that point) as a DMA-BUF. It may also try and close stdin when a buffer object is destroyed. Fix this by initializing the DMA-BUF file descriptor to -1, properly marking it as an invalid file descriptor. Fixes:c86dabfc9f
("omap: zero is a valid fd number, treat it as such") Reported-by: Robert Nelson <robertcnelson@gmail.com> Tested-by: Robert Nelson <robertcnelson@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
parent
a5ea0c64c5
commit
508a5f77fa
|
@ -186,6 +186,7 @@ static struct omap_bo * bo_from_handle(struct omap_device *dev,
|
||||||
}
|
}
|
||||||
bo->dev = omap_device_ref(dev);
|
bo->dev = omap_device_ref(dev);
|
||||||
bo->handle = handle;
|
bo->handle = handle;
|
||||||
|
bo->fd = -1;
|
||||||
atomic_set(&bo->refcnt, 1);
|
atomic_set(&bo->refcnt, 1);
|
||||||
/* add ourselves to the handle table: */
|
/* add ourselves to the handle table: */
|
||||||
drmHashInsert(dev->handle_table, handle, bo);
|
drmHashInsert(dev->handle_table, handle, bo);
|
||||||
|
|
Loading…
Reference in New Issue