diff mbox series

drm/msm: Fix legacy relocs path

Message ID 20210204225650.1284384-1-robdclark@gmail.com
State New
Headers show
Series drm/msm: Fix legacy relocs path | expand

Commit Message

Rob Clark Feb. 4, 2021, 10:56 p.m. UTC
From: Rob Clark <robdclark@chromium.org>

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 <emil.velikov@collabora.com>
Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Akhil P Oommen Feb. 5, 2021, 6:41 a.m. UTC | #1
On 2/5/2021 4:26 AM, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>

> 

> 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 <emil.velikov@collabora.com>

> Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")

> Signed-off-by: Rob Clark <robdclark@chromium.org>

> ---

>   drivers/gpu/drm/msm/msm_gem_submit.c | 2 ++

>   1 file changed, 2 insertions(+)

> 

> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c

> index d04c349d8112..5480852bdeda 100644

> --- a/drivers/gpu/drm/msm/msm_gem_submit.c

> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c

> @@ -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: */

> 


Reviewed-by: Akhil P Oommen <akhilpo@codeaurora.org>


-Akhil.
patchwork-bot+linux-arm-msm@kernel.org March 1, 2021, 7:59 p.m. UTC | #2
Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Thu,  4 Feb 2021 14:56:49 -0800 you wrote:
> From: Rob Clark <robdclark@chromium.org>

> 

> 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
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index d04c349d8112..5480852bdeda 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -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: */