All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Airlie <airlied@linux.ie>,
	Ilja Van Sprundel <ivansprundel@ioactive.com>
Cc: security@kernel.org, "Marek Olšák" <marek.olsak@amd.com>,
	dri-devel@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"monk.liu" <monk.liu@amd.com>
Subject: [patch 3/4] drm/amdgpu: info leak in amdgpu_gem_metadata_ioctl()
Date: Wed, 23 Sep 2015 14:00:35 +0300	[thread overview]
Message-ID: <20150923110035.GC16158@mwanda> (raw)
In-Reply-To: <13E61BCA7787794E89BDF39B8DE40C024D12E9F63F@ioaexchange.ioactive.local>

There is no limit on args->data.data_size_bytes so we could read beyond
the end of the args->data.data[] array.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 5839fab..dac14de 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -426,6 +426,10 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
 					   &args->data.data_size_bytes,
 					   &args->data.flags);
 	} else if (args->op == AMDGPU_GEM_METADATA_OP_SET_METADATA) {
+		if (args->data.data_size_bytes > sizeof(args->data.data)) {
+			r = -EINVAL;
+			goto unreserve;
+		}
 		r = amdgpu_bo_set_tiling_flags(robj, args->data.tiling_info);
 		if (!r)
 			r = amdgpu_bo_set_metadata(robj, args->data.data,
@@ -433,6 +437,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
 						   args->data.flags);
 	}
 
+unreserve:
 	amdgpu_bo_unreserve(robj);
 out:
 	drm_gem_object_unreference_unlocked(gobj);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-09-23 11:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <13E61BCA7787794E89BDF39B8DE40C024D12E9F63F@ioaexchange.ioactive.local>
2015-09-23 10:59 ` [patch 1/4] drm/amdgpu: unwind properly in amdgpu_cs_parser_init() Dan Carpenter
2015-09-23 14:16   ` Christian König
2015-09-23 17:13     ` Alex Deucher
2015-09-24  7:56       ` Dan Carpenter
2015-09-24 12:56         ` Deucher, Alexander
2015-09-25 11:36           ` [patch] drm/amdgpu: signedness bug " Dan Carpenter
2015-09-25 11:36             ` Dan Carpenter
2015-09-29 17:44             ` Alex Deucher
2015-09-29 17:44               ` Alex Deucher
2015-09-23 11:00 ` [patch 2/4] drm/amdgpu: integer overflow in amdgpu_info_ioctl() Dan Carpenter
2015-09-23 11:00 ` Dan Carpenter [this message]
2015-09-23 11:00 ` [patch 4/4] drm/amdgpu: integer overflow in amdgpu_mode_dumb_create() Dan Carpenter

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=20150923110035.GC16158@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ivansprundel@ioactive.com \
    --cc=marek.olsak@amd.com \
    --cc=monk.liu@amd.com \
    --cc=security@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.