diff options
author | Rob Clark <robdclark@gmail.com> | 2017-06-13 09:15:36 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2017-06-16 11:16:01 -0400 |
commit | cb1e38181a0728777057fb03fc4cddb29b7fb24d (patch) | |
tree | 27fbe164012963de61373865d74a73a289663752 /drivers/gpu/drm/msm/msm_gem.c | |
parent | 42a105e9cfaf0a0c74fdac5ba4ff17d6c0b024cd (diff) | |
download | op-kernel-dev-cb1e38181a0728777057fb03fc4cddb29b7fb24d.zip op-kernel-dev-cb1e38181a0728777057fb03fc4cddb29b7fb24d.tar.gz |
drm/msm: fix locking inconsistency for gpu->hw_init()
Most, but not all, paths where calling the with struct_mutex held. The
fast-path in msm_gem_get_iova() (plus some sub-code-paths that only run
the first time) was masking this issue.
So lets just always hold struct_mutex for hw_init(). And sprinkle some
WARN_ON()'s and might_lock() to avoid this sort of problem in the
future.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gem.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index be77a35..38fbaad 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -314,6 +314,8 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id, struct msm_gem_object *msm_obj = to_msm_bo(obj); int ret = 0; + WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex)); + if (!msm_obj->domain[id].iova) { struct msm_drm_private *priv = obj->dev->dev_private; struct page **pages = get_pages(obj); @@ -345,6 +347,7 @@ int msm_gem_get_iova(struct drm_gem_object *obj, int id, uint64_t *iova) * bo is deleted: */ if (msm_obj->domain[id].iova) { + might_lock(&obj->dev->struct_mutex); *iova = msm_obj->domain[id].iova; return 0; } |