From: Ondrej Zary <linux@zary.sk>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: nouveau@lists.freedesktop.org, bskeggs@redhat.com,
dri-devel@lists.freedesktop.org
Subject: Re: [Nouveau] [PATCH] drm/nouveau: fix dma_address check for CPU/GPU sync
Date: Mon, 14 Jun 2021 18:40:12 +0200 [thread overview]
Message-ID: <202106141840.12702.linux@zary.sk> (raw)
In-Reply-To: <20210614110517.1624-1-christian.koenig@amd.com>
On Monday 14 June 2021 13:05:17 Christian König wrote:
> AGP for example doesn't have a dma_address array.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes NULL pointer dereference in nouveau_bo_sync_for_device on AGP cards.
Tested-by: Ondrej Zary <linux@zary.sk>
> ---
> drivers/gpu/drm/nouveau/nouveau_bo.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 3e09df0472ce..170aba99a110 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -546,7 +546,7 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo)
> struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm;
> int i, j;
>
> - if (!ttm_dma)
> + if (!ttm_dma || !ttm_dma->dma_address)
> return;
> if (!ttm_dma->pages) {
> NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);
> @@ -582,7 +582,7 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo)
> struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm;
> int i, j;
>
> - if (!ttm_dma)
> + if (!ttm_dma || !ttm_dma->dma_address)
> return;
> if (!ttm_dma->pages) {
> NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);
--
Ondrej Zary
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
next prev parent reply other threads:[~2021-06-14 16:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 11:05 [Nouveau] [PATCH] drm/nouveau: fix dma_address check for CPU/GPU sync Christian König
2021-06-14 16:40 ` Ondrej Zary [this message]
2021-06-22 9:32 ` Christian König
2021-06-22 13:27 ` Alex Deucher
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=202106141840.12702.linux@zary.sk \
--to=linux@zary.sk \
--cc=bskeggs@redhat.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
/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).