Skip to content

Commit

Permalink
drm/msm: Fix legacy relocs path
Browse files Browse the repository at this point in the history
[ Upstream commit c8d99bb ]

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: 20224d7 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Akhil P Oommen <akhilpo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
robclark authored and gregkh committed Mar 4, 2021
1 parent 1dae20e commit ce32c2c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/msm/msm_gem_submit.c
Expand Up @@ -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: */
Expand Down

0 comments on commit ce32c2c

Please sign in to comment.