drm/msm: Fix legacy relocs path
PATCH 1/1 drm/msm: Fix legacy relocs path
From: Rob Clark <[email protected]>
In moving code around, we ended up using the same pointer to copy_from_user() the relocs tables as we used for the cmd table entry, which is clearly not right. This went unnoticed because modern mesa on non-ancent kernels does not actually use relocs. But this broke ancient mesa on modern kernels.
--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/msm_gem_submit.c +2 -0
@@ -198,6 +198,8 @@ static int submit_lookup_cmds(struct msm_gem_submit *submit, submit->cmd[i].idx = submit_cmd.submit_idx; submit->cmd[i].nr_relocs = submit_cmd.nr_relocs; + userptr =u64_to_user_ptr (submit_cmd.relocs); + sz =array_size (submit_cmd.nr_relocs,sizeof (struct drm_msm_gem_submit_reloc ));/* check for overflow: */
Signature · 6 lines
2.29.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 21 lines · Rob Clark
From: Rob Clark <[email protected]>
In moving code around, we ended up using the same pointer to
copy_from_user()the relocs tables as we used for the cmd table entry, which is clearly not right. This went unnoticed because modern mesa on non-ancent kernels does not actually use relocs. But this broke ancient mesa on modern kernels.Reported-by Emil Velikov <[email protected]>Fixes 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/msm/msm_gem_submit.c +0
-0
drivers/gpu/drm/msm/msm_gem_submit.c static int submit_lookup_cmds(struct msm_gem_submit *submit, · line 205
Quoted 8 lines
drivers/gpu/drm/msm/msm_gem_submit.c +2
-0@@ -198,6 +198,8 @@ static int submit_lookup_cmds(struct msm_gem_submit *submit, submit->cmd[i].idx = submit_cmd.submit_idx; submit->cmd[i].nr_relocs = submit_cmd.nr_relocs; + userptr =u64_to_user_ptr (submit_cmd.relocs); + sz =array_size (submit_cmd.nr_relocs,sizeof (struct drm_msm_gem_submit_reloc ));/* check for overflow: */
-Akhil.
This patch was applied to qcom/linux.git (refs/heads/for-next):
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
Quoted 9 lines · On Thu, 4 Feb 2021 14:56:49 -0800 you wrote:
From: Rob Clark <[email protected]>
In moving code around, we ended up using the same pointer to
copy_from_user()the relocs tables as we used for the cmd table entry, which is clearly not right. This went unnoticed because modern mesa on non-ancent kernels does not actually use relocs. But this broke ancient mesa on modern kernels.[...]
Here is the summary with links:
- drm/msm: Fix legacy relocs path
https://git.kernel.org/qcom/c/c8d99bb938d3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html