RE: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - Internal Distribution Only]

Thanks, Alex!

Regards,
Joe

-----Original Message-----
From: Alex Deucher <alexdeucher@xxxxxxxxx> 
Sent: Thursday, January 14, 2021 11:24 AM
To: amd-gfx list <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>; Su, Jinzhou (Joe) <Jinzhou.Su@xxxxxxx>
Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>
Subject: Re: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

+ Joe

On Mon, Jan 4, 2021 at 12:53 PM Alex Deucher <alexdeucher@xxxxxxxxx> wrote:
>
> Make sure the copy succeeded.  Also fixes a warning.
>
> v2: fix the error check
>
> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> index 455978781380..b033344c5ce2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> @@ -101,7 +101,9 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
>                 return -EINVAL;
>
>         memset(str,  0, sizeof(str));
> -       copy_from_user(str, buf, size);
> +       ret = copy_from_user(str, buf, size);
> +       if (ret)
> +               return -EFAULT;
>
>         ret = pm_runtime_get_sync(dev->dev);
>         if (ret < 0) {
> --
> 2.29.2
>
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux