public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: "Alex Jivin" <alex.jivin@amd.com>,
	"Frederick Lawler" <fred@fredlawl.com>,
	"David Airlie" <airlied@linux.ie>,
	kernel-janitors@vger.kernel.org,
	"amd-gfx list" <amd-gfx@lists.freedesktop.org>,
	"Sonny Jiang" <sonny.jiang@amd.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Monk Liu" <Monk.Liu@amd.com>,
	"Hawking Zhang" <Hawking.Zhang@amd.com>
Subject: Re: [PATCH 1/3] drm/amdgpu/si: Fix buffer overflow in si_get_register_value()
Date: Tue, 25 Aug 2020 18:53:24 +0000	[thread overview]
Message-ID: <20200825185324.GW5493@kadam> (raw)
In-Reply-To: <CADnq5_O0f7NdR92PSKFS0zrN4oFb_WJXX1E_HQ9uHzM-4NL2OQ@mail.gmail.com>

On Tue, Aug 25, 2020 at 11:53:25AM -0400, Alex Deucher wrote:
> On Tue, Aug 25, 2020 at 7:21 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > The values for "se_num" and "sh_num" come from the user in the ioctl.
> > They can be in the 0-255 range but if they're more than
> > AMDGPU_GFX_MAX_SE (4) or AMDGPU_GFX_MAX_SH_PER_SE (2) then it results in
> > an out of bounds read.
> >
> > I split this function into to two to make the error handling simpler.
> >
> > Fixes: dd5dfa61b4ff ("drm/amdgpu: refine si_read_register")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Good catch.  This is more defensive, but It's a much simpler check to
> validate these in the caller.  See the attached patch.
> 

That works too.

Acked-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter

      reply	other threads:[~2020-08-25 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 11:18 [PATCH 1/3] drm/amdgpu/si: Fix buffer overflow in si_get_register_value() Dan Carpenter
2020-08-25 11:19 ` [PATCH 2/3] drm/amdgpu/cik: fix buffer overflow in cik_get_register_value() Dan Carpenter
2020-08-25 11:19 ` [PATCH 3/3] drm/amdgpu/vi: fix buffer overflow in vi_get_register_value() Dan Carpenter
2020-08-25 15:53 ` [PATCH 1/3] drm/amdgpu/si: Fix buffer overflow in si_get_register_value() Alex Deucher
2020-08-25 18:53   ` Dan Carpenter [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=20200825185324.GW5493@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Monk.Liu@amd.com \
    --cc=airlied@linux.ie \
    --cc=alex.jivin@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bhelgaas@google.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=fred@fredlawl.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=sonny.jiang@amd.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