drm/msm: Take the mutex before calling msm_gem_new_impl
authorJordan Crouse <jcrouse@codeaurora.org>
Mon, 8 May 2017 20:34:57 +0000 (14:34 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:48:07 +0000 (19:48 +0200)
commita435a0ceadae59f839e0d4a47b771d68418e682b
tree35ae9812e5cb7bd2bcc6d3c7f5593ccb3aa7f664
parent04a87dfaf6ae215ee1b9eb3c796556dd914a65a2
drm/msm: Take the mutex before calling msm_gem_new_impl

[ Upstream commit 90dd57de4a043f642179b1323a31ca3ced826611 ]

Amongst its other duties, msm_gem_new_impl adds the newly created
GEM object to the shared inactive list which may also be actively
modifiying the list during submission.  All the paths to modify
the list are protected by the mutex except for the one through
msm_gem_import which can end up causing list corruption.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
[add extra WARN_ON(!mutex_is_locked(&dev->struct_mutex))]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/msm/msm_gem.c