From: Chia-I Wu <olvaffe@gmail.com>
To: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Cc: David Airlie <airlied@linux.ie>,
Gerd Hoffmann <kraxel@redhat.com>,
Gurchetan Singh <gurchetansingh@chromium.org>,
Daniel Vetter <daniel@ffwll.ch>, Dave Airlie <airlied@redhat.com>,
ML dri-devel <dri-devel@lists.freedesktop.org>,
"open list:VIRTIO CORE,
NET AND BLOCK DRIVERS"
<virtualization@lists.linux-foundation.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] virtio-gpu: fix a missing check to avoid NULL dereference
Date: Mon, 28 Mar 2022 14:08:20 -0700 [thread overview]
Message-ID: <CAPaKu7Q54aumxEjih3v=xiW3NG7ct1O5UBzyqMQ0bug4svy-5g@mail.gmail.com> (raw)
In-Reply-To: <20220327050945.1614-1-xiam0nd.tong@gmail.com>
On Sat, Mar 26, 2022 at 10:09 PM Xiaomeng Tong <xiam0nd.tong@gmail.com> wrote:
>
> 'cache_ent' could be set NULL inside virtio_gpu_cmd_get_capset()
> and it will lead to a NULL dereference by a lately use of it
> (i.e., ptr = cache_ent->caps_cache). Fix it with a NULL check.
>
> Fixes: 62fb7a5e10962 ("virtio-gpu: add 3d/virgl support")
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index c708bab555c6..b0f1c4d8fd23 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -579,8 +579,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
> spin_unlock(&vgdev->display_info_lock);
>
> /* not in cache - need to talk to hw */
> - virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver,
> + ret = virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver,
> &cache_ent);
> + if (ret)
> + return ret;
> virtio_gpu_notify(vgdev);
>
> copy_exit:
>
> base-commit: f443e374ae131c168a065ea1748feac6b2e76613
> --
> 2.17.1
>
prev parent reply other threads:[~2022-03-28 21:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-27 5:09 [PATCH] virtio-gpu: fix a missing check to avoid NULL dereference Xiaomeng Tong
2022-03-28 21:08 ` Chia-I Wu [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='CAPaKu7Q54aumxEjih3v=xiW3NG7ct1O5UBzyqMQ0bug4svy-5g@mail.gmail.com' \
--to=olvaffe@gmail.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xiam0nd.tong@gmail.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;
as well as URLs for NNTP newsgroup(s).