public inbox for linux-arm-msm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean@poorly.run>
To: Jordan Crouse <jcrouse@codeaurora.org>
Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	Sean Paul <sean@poorly.run>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Rob Clark <robdclark@gmail.com>, David Airlie <airlied@linux.ie>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH RESEND] drm/msm: Truncate the buffer object name if the copy from user failed
Date: Mon, 4 Mar 2019 16:01:36 -0500	[thread overview]
Message-ID: <20190304210136.GC114153@art_vandelay> (raw)
In-Reply-To: <1550601619-31051-1-git-send-email-jcrouse@codeaurora.org>

On Tue, Feb 19, 2019 at 11:40:19AM -0700, Jordan Crouse wrote:
> (Resend since there was a compile error that I forgot to commit before sending)
> 
> If there is a error while doing a copy_from_user() for MSM_INFO_SET_NAME
> make sure to truncate the object name so that there isn't a chance that
> we'll have random data in the string.
> 
> This is on top of [1] reported and fixed by Dan Carpenter.
> 
> [1] https://patchwork.freedesktop.org/series/56656/
> 
> Fixes: f05c83e77460 ("drm/msm: add uapi to get/set debug name")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

Reviewed-by: Sean Paul <sean@poorly.run>

> ---
> 
>  drivers/gpu/drm/msm/msm_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 87eae44..906b2bb 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -852,8 +852,11 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
>  			break;
>  		}
>  		if (copy_from_user(msm_obj->name, u64_to_user_ptr(args->value),
> -				   args->len))
> +				   args->len)) {
> +			msm_obj->name[0] = '\0';
>  			ret = -EFAULT;
> +			break;
> +		}
>  		msm_obj->name[args->len] = '\0';
>  		for (i = 0; i < args->len; i++) {
>  			if (!isprint(msm_obj->name[i])) {
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

      reply	other threads:[~2019-03-04 21:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 18:40 [PATCH RESEND] drm/msm: Truncate the buffer object name if the copy from user failed Jordan Crouse
2019-03-04 21:01 ` Sean Paul [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190304210136.GC114153@art_vandelay \
    --to=sean@poorly.run \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jcrouse@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox