diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2017-09-11 09:29:31 -0400 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2017-09-13 09:06:56 -0400 |
commit | 518417525f3652c12fb5fad6da4ade66c0072fa3 (patch) | |
tree | 57baead2833097aba997f0345313b09b6264f85d | |
parent | 5a642e6bc49f59922e19ebd639e74f72753fc77b (diff) |
etnaviv: fix gem object list corruption
All manipulations of the gem_object list need to be protected by
the list mutex, as GEM objects can be created and freed in parallel.
This fixes a kernel memory corruption.
CC: stable@vger.kernel.org
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c index 9a3bea738330..87b95eeedd9e 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c | |||
@@ -551,12 +551,15 @@ static const struct etnaviv_gem_ops etnaviv_gem_shmem_ops = { | |||
551 | void etnaviv_gem_free_object(struct drm_gem_object *obj) | 551 | void etnaviv_gem_free_object(struct drm_gem_object *obj) |
552 | { | 552 | { |
553 | struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); | 553 | struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); |
554 | struct etnaviv_drm_private *priv = obj->dev->dev_private; | ||
554 | struct etnaviv_vram_mapping *mapping, *tmp; | 555 | struct etnaviv_vram_mapping *mapping, *tmp; |
555 | 556 | ||
556 | /* object should not be active */ | 557 | /* object should not be active */ |
557 | WARN_ON(is_active(etnaviv_obj)); | 558 | WARN_ON(is_active(etnaviv_obj)); |
558 | 559 | ||
560 | mutex_lock(&priv->gem_lock); | ||
559 | list_del(&etnaviv_obj->gem_node); | 561 | list_del(&etnaviv_obj->gem_node); |
562 | mutex_unlock(&priv->gem_lock); | ||
560 | 563 | ||
561 | list_for_each_entry_safe(mapping, tmp, &etnaviv_obj->vram_list, | 564 | list_for_each_entry_safe(mapping, tmp, &etnaviv_obj->vram_list, |
562 | obj_node) { | 565 | obj_node) { |