Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4870006a authored by Jordan Crouse's avatar Jordan Crouse
Browse files

drm/msm: Take the mutex before calling msm_gem_new_impl



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.

Change-Id: Ic0dedbad6b68d4d3db726e0d598d4d21af4b328c
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 630218f7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -750,7 +750,10 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,

	size = PAGE_ALIGN(size);

	mutex_lock(&dev->struct_mutex);
	ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj);
	mutex_unlock(&dev->struct_mutex);

	if (ret)
		goto fail;

+1 −2
Original line number Diff line number Diff line
@@ -576,8 +576,7 @@ int msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)

		if (submit->bos[i].flags & MSM_SUBMIT_BO_READ)
			msm_gem_move_to_active(&msm_obj->base, gpu, false, submit->fence);

		if (submit->bos[i].flags & MSM_SUBMIT_BO_WRITE)
		else if (submit->bos[i].flags & MSM_SUBMIT_BO_WRITE)
			msm_gem_move_to_active(&msm_obj->base, gpu, true, submit->fence);
	}