drm: Branch 'master'
[email protected] (Eric Engestr??m) Thu, 14 Sep 2017 09:43:28 +0000 (UTC)
| Newsgroups | gmane.comp.video.dri.patches |
|---|---|
| Message-ID | <[email protected]> |
etnaviv/etnaviv_bo.c | 5 +++++ 1 file changed, 5 insertions(+) New commits: commit 6dca9387d20204898f9e831d59b725d062513fd0 Author: Philipp Zabel <[email protected]> Date: Wed Sep 13 16:08:19 2017 +0200 etnaviv: prevent deadlock in error path If drmPrimeFDToHandle fails in etna_bo_from_dmabuf, the function must not return with the table_lock mutex held. Unlock the mutex in the error path. Based on ceb70a6b1015 ("freedreno: prevent deadlock in error path"). Signed-off-by: Philipp Zabel <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> diff --git a/etnaviv/etnaviv_bo.c b/etnaviv/etnaviv_bo.c index 4fe877f1..78b9cd27 100644 --- a/etnaviv/etnaviv_bo.c +++ b/etnaviv/etnaviv_bo.c @@ -206,10 +206,15 @@ struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd) int ret, size; uint32_t handle; + /* take the lock before calling drmPrimeFDToHandle to avoid + * racing against etna_bo_del, which might invalidate the + * returned handle. + */ pthread_mutex_lock(&table_lock); ret = drmPrimeFDToHandle(dev->fd, fd, &handle); if (ret) { + pthread_mutex_unlock(&table_lock); return NULL; } ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot --