path: root/omap
diff options
authorThierry Reding2015-08-26 03:05:48 -0500
committerThierry Reding2015-08-26 08:15:54 -0500
commit508a5f77fa7b76246465ca620c8badf281218529 (patch)
treea0dbb19cb35132ad2103121ef437c9f72ec71175 /omap
parenta5ea0c64c5ce673662249557b03c412fcc53e6c1 (diff)
omap: Initialize DMA BUF file descriptor to -1
Commit c86dabfc9f04 ("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: c86dabfc9f04 ("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>
Diffstat (limited to 'omap')
1 files changed, 1 insertions, 0 deletions
diff --git a/omap/omap_drm.c b/omap/omap_drm.c
index 4a0248d5..08ba64eb 100644
--- a/omap/omap_drm.c
+++ b/omap/omap_drm.c
@@ -186,6 +186,7 @@ static struct omap_bo * bo_from_handle(struct omap_device *dev,
186 } 186 }
187 bo->dev = omap_device_ref(dev); 187 bo->dev = omap_device_ref(dev);
188 bo->handle = handle; 188 bo->handle = handle;
189 bo->fd = -1;
189 atomic_set(&bo->refcnt, 1); 190 atomic_set(&bo->refcnt, 1);
190 /* add ourselves to the handle table: */ 191 /* add ourselves to the handle table: */
191 drmHashInsert(dev->handle_table, handle, bo); 192 drmHashInsert(dev->handle_table, handle, bo);