From: Daniel Vetter <daniel@ffwll.ch>
To: Alisa Khabibrakhmanova <khabibrakhmanova@ispras.ru>
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Thomas Zimmermann <tzimmermann@suse.de>,
Sam Ravnborg <sam@ravnborg.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: Re: [PATCH] drm/via: Add new condition to via_dma_cleanup()
Date: Tue, 6 Sep 2022 21:25:18 +0200 [thread overview]
Message-ID: <YxeengBAncBqNab0@phenom.ffwll.local> (raw)
In-Reply-To: <20220729090643.240778-1-khabibrakhmanova@ispras.ru>
On Fri, Jul 29, 2022 at 12:06:43PM +0300, Alisa Khabibrakhmanova wrote:
> Pointer dev_priv->mmio, which was checked for NULL at via_do_init_map(),
> is passed to via_do_cleanup_map() and is dereferenced there without check.
>
> The patch adds the condition in via_dma_cleanup() which prevents potential NULL
> pointer dereference.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 22f579c621e2 ("drm: Add via unichrome support")
> Signed-off-by: Alisa Khabibrakhmanova <khabibrakhmanova@ispras.ru>
This seems to have fallen through cracks, I applied it to drm-misc-next
now.
Thanks for your patch.
-Daniel
> ---
> drivers/gpu/drm/via/via_dri1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/via/via_dri1.c b/drivers/gpu/drm/via/via_dri1.c
> index d695d9291ece..691e3ceb0062 100644
> --- a/drivers/gpu/drm/via/via_dri1.c
> +++ b/drivers/gpu/drm/via/via_dri1.c
> @@ -2961,7 +2961,7 @@ int via_dma_cleanup(struct drm_device *dev)
> drm_via_private_t *dev_priv =
> (drm_via_private_t *) dev->dev_private;
>
> - if (dev_priv->ring.virtual_start) {
> + if (dev_priv->ring.virtual_start && dev_priv->mmio) {
> via_cmdbuf_reset(dev_priv);
>
> drm_legacy_ioremapfree(&dev_priv->ring.map, dev);
> --
> 2.34.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2022-09-06 19:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 10:45 [PATCH] drm/via: Add new condition to via_dma_cleanup() Alisa Khabibrakhmanova
2022-07-26 17:23 ` Sam Ravnborg
2022-07-29 9:06 ` Alisa Khabibrakhmanova
2022-09-06 19:25 ` Daniel Vetter [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=YxeengBAncBqNab0@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=khabibrakhmanova@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.de \
/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