All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Herrmann <dh.herrmann@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	David Airlie <airlied@linux.ie>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/ttm: make sure format string cannot leak in
Date: Fri, 12 Sep 2014 10:28:11 +0200	[thread overview]
Message-ID: <CANq1E4Q7mSFyj0chxjH1=wE+ZOL4_WKDwzkvm0GPGunYAfTmBQ@mail.gmail.com> (raw)
In-Reply-To: <20140911205354.GA2959@www.outflux.net>

Hi

On Thu, Sep 11, 2014 at 10:53 PM, Kees Cook <keescook@chromium.org> wrote:
> While zone->name is currently hard coded, the call to kobject_init_and_add()
> should follow the more defensive argument list usage (as already done in
> other places in ttm_memory.c) where "%s" is used instead of directly passing
> in a variable as a format string.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

> ---
>  drivers/gpu/drm/ttm/ttm_memory.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
> index fa53df487875..1e688b603e46 100644
> --- a/drivers/gpu/drm/ttm/ttm_memory.c
> +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> @@ -300,7 +300,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob,
>         zone->glob = glob;
>         glob->zone_highmem = zone;
>         ret = kobject_init_and_add(
> -               &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
> +               &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, "%s",
> +               zone->name);
>         if (unlikely(ret != 0)) {
>                 kobject_put(&zone->kobj);
>                 return ret;
> --
> 1.9.1
>
>
> --
> Kees Cook
> Chrome OS Security
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

WARNING: multiple messages have this Message-ID (diff)
From: David Herrmann <dh.herrmann@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/ttm: make sure format string cannot leak in
Date: Fri, 12 Sep 2014 10:28:11 +0200	[thread overview]
Message-ID: <CANq1E4Q7mSFyj0chxjH1=wE+ZOL4_WKDwzkvm0GPGunYAfTmBQ@mail.gmail.com> (raw)
In-Reply-To: <20140911205354.GA2959@www.outflux.net>

Hi

On Thu, Sep 11, 2014 at 10:53 PM, Kees Cook <keescook@chromium.org> wrote:
> While zone->name is currently hard coded, the call to kobject_init_and_add()
> should follow the more defensive argument list usage (as already done in
> other places in ttm_memory.c) where "%s" is used instead of directly passing
> in a variable as a format string.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

> ---
>  drivers/gpu/drm/ttm/ttm_memory.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
> index fa53df487875..1e688b603e46 100644
> --- a/drivers/gpu/drm/ttm/ttm_memory.c
> +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> @@ -300,7 +300,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob,
>         zone->glob = glob;
>         glob->zone_highmem = zone;
>         ret = kobject_init_and_add(
> -               &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
> +               &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, "%s",
> +               zone->name);
>         if (unlikely(ret != 0)) {
>                 kobject_put(&zone->kobj);
>                 return ret;
> --
> 1.9.1
>
>
> --
> Kees Cook
> Chrome OS Security
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2014-09-12  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 20:53 [PATCH] drm/ttm: make sure format string cannot leak in Kees Cook
2014-09-12  8:28 ` David Herrmann [this message]
2014-09-12  8:28   ` David Herrmann

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='CANq1E4Q7mSFyj0chxjH1=wE+ZOL4_WKDwzkvm0GPGunYAfTmBQ@mail.gmail.com' \
    --to=dh.herrmann@gmail.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.