Commit f722f5be authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-fixes-2021-01-20' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

Short summary of fixes pull (less than what git shortlog provides):

 * drm/atomic: Release state on error
 * drm/syncobj: Fix use-after-free
 * drm/ttm: Don't use GFP_TRANSHUGE_LIGTH
 * drm/vc4: Unify driver naming for PCM
 * drm/vram-helper: Fix memory leak in vmap
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/YAgdYGNoH7pC29rz@linux-uq9g
parents 19c329f6 a37eef63
...@@ -3021,7 +3021,7 @@ int drm_atomic_helper_set_config(struct drm_mode_set *set, ...@@ -3021,7 +3021,7 @@ int drm_atomic_helper_set_config(struct drm_mode_set *set,
ret = handle_conflicting_encoders(state, true); ret = handle_conflicting_encoders(state, true);
if (ret) if (ret)
return ret; goto fail;
ret = drm_atomic_commit(state); ret = drm_atomic_commit(state);
......
...@@ -387,9 +387,16 @@ static int drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo, ...@@ -387,9 +387,16 @@ static int drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo,
if (gbo->vmap_use_count > 0) if (gbo->vmap_use_count > 0)
goto out; goto out;
ret = ttm_bo_vmap(&gbo->bo, &gbo->map); /*
if (ret) * VRAM helpers unmap the BO only on demand. So the previous
return ret; * page mapping might still be around. Only vmap if the there's
* no mapping present.
*/
if (dma_buf_map_is_null(&gbo->map)) {
ret = ttm_bo_vmap(&gbo->bo, &gbo->map);
if (ret)
return ret;
}
out: out:
++gbo->vmap_use_count; ++gbo->vmap_use_count;
...@@ -577,6 +584,7 @@ static void drm_gem_vram_bo_driver_move_notify(struct drm_gem_vram_object *gbo, ...@@ -577,6 +584,7 @@ static void drm_gem_vram_bo_driver_move_notify(struct drm_gem_vram_object *gbo,
return; return;
ttm_bo_vunmap(bo, &gbo->map); ttm_bo_vunmap(bo, &gbo->map);
dma_buf_map_clear(&gbo->map); /* explicitly clear mapping for next vmap call */
} }
static int drm_gem_vram_bo_driver_move(struct drm_gem_vram_object *gbo, static int drm_gem_vram_bo_driver_move(struct drm_gem_vram_object *gbo,
......
...@@ -388,19 +388,18 @@ int drm_syncobj_find_fence(struct drm_file *file_private, ...@@ -388,19 +388,18 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
return -ENOENT; return -ENOENT;
*fence = drm_syncobj_fence_get(syncobj); *fence = drm_syncobj_fence_get(syncobj);
drm_syncobj_put(syncobj);
if (*fence) { if (*fence) {
ret = dma_fence_chain_find_seqno(fence, point); ret = dma_fence_chain_find_seqno(fence, point);
if (!ret) if (!ret)
return 0; goto out;
dma_fence_put(*fence); dma_fence_put(*fence);
} else { } else {
ret = -EINVAL; ret = -EINVAL;
} }
if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)) if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
return ret; goto out;
memset(&wait, 0, sizeof(wait)); memset(&wait, 0, sizeof(wait));
wait.task = current; wait.task = current;
...@@ -432,6 +431,9 @@ int drm_syncobj_find_fence(struct drm_file *file_private, ...@@ -432,6 +431,9 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
if (wait.node.next) if (wait.node.next)
drm_syncobj_remove_wait(syncobj, &wait); drm_syncobj_remove_wait(syncobj, &wait);
out:
drm_syncobj_put(syncobj);
return ret; return ret;
} }
EXPORT_SYMBOL(drm_syncobj_find_fence); EXPORT_SYMBOL(drm_syncobj_find_fence);
......
...@@ -79,12 +79,13 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags, ...@@ -79,12 +79,13 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags,
struct page *p; struct page *p;
void *vaddr; void *vaddr;
if (order) { /* Don't set the __GFP_COMP flag for higher order allocations.
gfp_flags |= GFP_TRANSHUGE_LIGHT | __GFP_NORETRY | * Mapping pages directly into an userspace process and calling
* put_page() on a TTM allocated page is illegal.
*/
if (order)
gfp_flags |= __GFP_NOMEMALLOC | __GFP_NORETRY |
__GFP_KSWAPD_RECLAIM; __GFP_KSWAPD_RECLAIM;
gfp_flags &= ~__GFP_MOVABLE;
gfp_flags &= ~__GFP_COMP;
}
if (!pool->use_dma_alloc) { if (!pool->use_dma_alloc) {
p = alloc_pages(gfp_flags, order); p = alloc_pages(gfp_flags, order);
......
...@@ -1267,6 +1267,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) ...@@ -1267,6 +1267,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
card->dai_link = dai_link; card->dai_link = dai_link;
card->num_links = 1; card->num_links = 1;
card->name = vc4_hdmi->variant->card_name; card->name = vc4_hdmi->variant->card_name;
card->driver_name = "vc4-hdmi";
card->dev = dev; card->dev = dev;
card->owner = THIS_MODULE; card->owner = THIS_MODULE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment