From: Christian Zigotzky <chzigotzky@xenosoft.de>
To: Vivek Kasireddy <vivek.kasireddy@intel.com>,
dri-devel@lists.freedesktop.org
Cc: Darren Stevens <darren@stevens-zone.net>,
mad skateman <madskateman@gmail.com>,
"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
Gurchetan Singh <gurchetansingh@chromium.org>,
Gerd Hoffmann <kraxel@redhat.com>,
"R.T.Dickinson" <rtd2@xtra.co.nz>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Christian Zigotzky <info@xenosoft.de>
Subject: Re: [PATCH] drm/virtio: Fix NULL dereference error in virtio_gpu_poll
Date: Fri, 05 Nov 2021 18:05:22 +0000 [thread overview]
Message-ID: <aa9ce992-e48f-31b4-cc3e-3300bd557dc8@xenosoft.de> (raw)
In-Reply-To: <20211104214249.1802789-1-vivek.kasireddy@intel.com>
On 04 November 2021 at 10:42 pm, Vivek Kasireddy wrote:
> When virgl is not enabled, vfpriv pointer would not be allocated.
> Therefore, check for a valid value before dereferencing.
>
> Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_drv.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c
b/drivers/gpu/drm/virtio/virtgpu_drv.c
> index 749db18dcfa2..d86e1ad4a972 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> @@ -163,10 +163,11 @@ static __poll_t virtio_gpu_poll(struct file *filp,
> struct drm_file *drm_file = filp->private_data;
> struct virtio_gpu_fpriv *vfpriv = drm_file->driver_priv;
> struct drm_device *dev = drm_file->minor->dev;
> + struct virtio_gpu_device *vgdev = dev->dev_private;
> struct drm_pending_event *e = NULL;
> __poll_t mask = 0;
>
> - if (!vfpriv->ring_idx_mask)
> + if (!vgdev->has_virgl_3d || !vfpriv || !vfpriv->ring_idx_mask)
> return drm_poll(filp, wait);
>
> poll_wait(filp, &drm_file->event_wait, wait);
Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de> [1]
[1] https://i.ibb.co/N1vL5Kd/Kernel-5-16-alpha3-Power-PC.png
parent reply other threads:[~2021-11-05 18:05 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20211104214249.1802789-1-vivek.kasireddy@intel.com>]
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=aa9ce992-e48f-31b4-cc3e-3300bd557dc8@xenosoft.de \
--to=chzigotzky@xenosoft.de \
--cc=darren@stevens-zone.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=info@xenosoft.de \
--cc=kraxel@redhat.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=madskateman@gmail.com \
--cc=rtd2@xtra.co.nz \
--cc=vivek.kasireddy@intel.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 read-only IMAP folder(s) and NNTP newsgroup(s).