]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/msm: Fix legacy relocs path
authorRob Clark <robdclark@chromium.org>
Thu, 4 Feb 2021 22:53:11 +0000 (14:53 -0800)
committerRob Clark <robdclark@chromium.org>
Fri, 5 Feb 2021 18:00:10 +0000 (10:00 -0800)
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>
Reviewed-by: Akhil P Oommen <akhilpo@codeaurora.org>
drivers/gpu/drm/msm/msm_gem_submit.c

index d04c349d8112aaa18fc1642d62ddc225437dfeae..5480852bdedafcc43504547bf2762d8722a741ad 100644 (file)
@@ -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: */