From: "Michel Dänzer" <michel@daenzer.net>
To: Yu Zhao <yuzhao@google.com>
Cc: "David Zhou" <David1.Zhou@amd.com>,
"Daniel Stone" <daniels@collabora.com>,
"David Airlie" <airlied@linux.ie>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
"Junwei Zhang" <Jerry.Zhang@amd.com>,
amd-gfx@lists.freedesktop.org, "Daniel Vetter" <daniel@ffwll.ch>,
"Alex Deucher" <alexander.deucher@amd.com>,
stable@vger.kernel.org, "Harry Wentland" <harry.wentland@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Samuel Li" <Samuel.Li@amd.com>
Subject: Re: [PATCH v5 1/2] drm/amd: validate user pitch alignment
Date: Mon, 7 Jan 2019 10:54:03 +0100 [thread overview]
Message-ID: <14420828-884e-df3e-3b41-5b87203a20a3@daenzer.net> (raw)
In-Reply-To: <20190107040038.GA180037@google.com>
On 2019-01-07 5:00 a.m., Yu Zhao wrote:
> On Thu, Jan 03, 2019 at 05:33:19PM +0100, Michel Dänzer wrote:
>> On 2018-12-30 2:00 a.m., Yu Zhao wrote:
>>> Userspace may request pitch alignment that is not supported by GPU.
>>> Some requests 32, but GPU ignores it and uses default 64 when cpp is
>>> 4. If GEM object is allocated based on the smaller alignment, GPU
>>> DMA will go out of bound.
>>>
>>> Cc: stable@vger.kernel.org # v4.2+
>>> Signed-off-by: Yu Zhao <yuzhao@google.com>
>>> ---
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 16 ++++++++++++++++
>>> 1 file changed, 16 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>>> index 15ce7e681d67..16af80ccd0a0 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>>> @@ -527,6 +527,22 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
>>> struct drm_gem_object *obj;
>>> struct amdgpu_framebuffer *amdgpu_fb;
>>> int ret;
>>> + struct amdgpu_device *adev = dev->dev_private;
>>> + int cpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0);
>>> + int pitch = mode_cmd->pitches[0] / cpp;
>>> +
>>> + if (pitch < mode_cmd->width) {
>>> + DRM_DEBUG_KMS("Expecting pitch(%d)/cpp(%d) >= width(%d)\n",
>>> + mode_cmd->pitches[0], cpp, mode_cmd->width);
>>> + return ERR_PTR(-EINVAL);
>>> + }
>>
>> This should possibly be tested in drm_internal_framebuffer_create instead.
>
> It seems to me drm_format_info_min_pitch() in framebuffer_check()
> already does it. We could just remove the check here?
Yeah, looks like that should be fine.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
next prev parent reply other threads:[~2019-01-07 9:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 3:10 [PATCH 1/3] drm/amd: fix race in page flip job Yu Zhao
2018-12-21 3:10 ` [PATCH 2/3] drm/amd: validate user pitch alignment Yu Zhao
2018-12-21 9:04 ` Michel Dänzer
2018-12-21 9:07 ` Michel Dänzer
2018-12-21 19:41 ` Yu Zhao
2018-12-23 21:44 ` Yu Zhao
2018-12-27 11:54 ` Michel Dänzer
2018-12-21 19:47 ` [PATCH v2 1/2] " Yu Zhao
2018-12-21 19:47 ` [PATCH v2 2/2] drm/amd: validate user GEM object size Yu Zhao
2018-12-22 9:40 ` kbuild test robot
2018-12-23 7:46 ` kbuild test robot
2018-12-22 19:27 ` [PATCH v3 1/2] drm/amd: validate user pitch alignment Yu Zhao
2018-12-22 19:27 ` [PATCH v3 2/2] drm/amd: validate user GEM object size Yu Zhao
2018-12-23 21:52 ` [PATCH v4 1/2] drm/amd: validate user pitch alignment Yu Zhao
2018-12-23 21:52 ` [PATCH v4 2/2] drm/amd: validate user GEM object size Yu Zhao
2018-12-30 1:00 ` [PATCH v5 1/2] drm/amd: validate user pitch alignment Yu Zhao
2018-12-30 1:00 ` [PATCH v5 2/2] drm/amd: validate user GEM object size Yu Zhao
2019-01-03 16:33 ` [PATCH v5 1/2] drm/amd: validate user pitch alignment Michel Dänzer
2019-01-07 4:00 ` Yu Zhao
2019-01-07 9:54 ` Michel Dänzer [this message]
2019-01-07 22:51 ` [PATCH v6 " Yu Zhao
2019-01-07 22:51 ` [PATCH v6 2/2] drm/amd: validate user GEM object size Yu Zhao
2019-01-08 15:25 ` [PATCH v6 1/2] drm/amd: validate user pitch alignment Michel Dänzer
2018-12-21 3:10 ` [PATCH 3/3] drm/amd: validate user GEM object size Yu Zhao
2018-12-21 9:09 ` Michel Dänzer
2018-12-22 4:51 ` kbuild test robot
2018-12-21 8:56 ` [PATCH 1/3] drm/amd: fix race in page flip job Michel Dänzer
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=14420828-884e-df3e-3b41-5b87203a20a3@daenzer.net \
--to=michel@daenzer.net \
--cc=David1.Zhou@amd.com \
--cc=Jerry.Zhang@amd.com \
--cc=Samuel.Li@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yuzhao@google.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
all inboxes | Powered by JetHome®