Skip to contentSkip to conversation

drm/msm: Fix legacy relocs path

PATCH Applied Rob Clark 3 participants 3 messages Feb 4, 2021 – Mar 1, 2021

Subsystems (3)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

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.

Fixes 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/msm_gem_submit.c +2 -0
index d04c349d8112..5480852bdeda 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
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.

Fixes 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
---
  drivers/gpu/drm/msm/msm_gem_submit.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/msm_gem_submit.c +0 -0
index d04c349d8112..5480852bdeda 100644

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.

#2 lore raw
In reply to Rob Clark
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