All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Joachim <svenjoac@gmx.de>
To: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: fix NULL pointer access by wrong ioctl
Date: Mon, 30 Jun 2014 18:04:43 +0200	[thread overview]
Message-ID: <87y4wez8mc.fsf@turtle.gmx.de> (raw)
In-Reply-To: <1403073239-6493-1-git-send-email-zhaowei.yuan@samsung.com> (Zhaowei Yuan's message of "Wed, 18 Jun 2014 14:33:59 +0800")

On 2014-06-18 08:33 +0200, Zhaowei Yuan wrote:

> If user uses wrong ioctl command with _IOC_NONE and argument size
> greater than 0, it can cause NULL pointer access from memset of line
> 463. If _IOC_NONE, don't memset to 0 for kdata.
>
> Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
> ---
>  drivers/gpu/drm/drm_drv.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>  mode change 100644 => 100755 drivers/gpu/drm/drm_drv.c

The mode change certainly was not intentional, was it?  Just noticed it
when I pulled 3.16-rc3 from Linus…

> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> old mode 100644
> new mode 100755
> index 2ab782c..1a92bcb
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -459,8 +459,9 @@ long drm_ioctl(struct file *filp,
>  				retcode = -EFAULT;
>  				goto err_i1;
>  			}
> -		} else
> +		} else if (cmd & IOC_OUT) {
>  			memset(kdata, 0, usize);
> +		}
>
>  		if (ioctl->flags & DRM_UNLOCKED)
>  			retcode = func(dev, kdata, file_priv);


Cheers,
       Sven
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2014-06-30 16:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18  6:33 [PATCH] drm: fix NULL pointer access by wrong ioctl Zhaowei Yuan
2014-06-20 14:25 ` David Herrmann
2014-06-30 16:04 ` Sven Joachim [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-18  6:31 yes

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=87y4wez8mc.fsf@turtle.gmx.de \
    --to=svenjoac@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=zhaowei.yuan@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.