OSDN Git Service

minigbm: ensure drm_prime_handle struct is correctly initialized
authorVincent Palatin <vpalatin@chromium.org>
Fri, 8 Apr 2016 17:03:52 +0000 (10:03 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 14 Apr 2016 01:37:16 +0000 (18:37 -0700)
the 'prime_handle' variable has a 'flags' and the kernel code for
DRM_IOCTL_PRIME_FD_TO_HANDLE will fail if 'flags' contains something
else than DRM_CLOEXEC or 0.
Right now, the 'flags' field is uninitialized and DRM initialization
fails on some VM configs with kernel 4.4.

BUG=chromium:591626
TEST=run null_platform_test and Chrome browser using the arm64-llvmpipe
overlay and kernel 4.4 on QEMU VM.

Change-Id: Ieac8eb280fe14f1e268f8869dcc9fe46c1bb9599
Reviewed-on: https://chromium-review.googlesource.com/337970
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
gbm.c

diff --git a/gbm.c b/gbm.c
index b438173..9c31fd3 100644 (file)
--- a/gbm.c
+++ b/gbm.c
@@ -275,6 +275,7 @@ gbm_bo_import(struct gbm_device *gbm, uint32_t type,
        bo->strides[0] = fd_data->stride;
        bo->sizes[0] = fd_data->height * fd_data->stride;
 
+       memset(&prime_handle, 0, sizeof(prime_handle));
        prime_handle.fd = fd_data->fd;
 
        ret = drmIoctl(bo->gbm->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &prime_handle);