* [Nouveau] [PATCH] drm/nouveau: fix dma_address check for CPU/GPU sync
@ 2021-06-14 11:05 Christian König
2021-06-14 16:40 ` Ondrej Zary
2021-06-22 9:32 ` Christian König
0 siblings, 2 replies; 4+ messages in thread
From: Christian König @ 2021-06-14 11:05 UTC (permalink / raw)
To: linux, bskeggs, dri-devel, nouveau
AGP for example doesn't have a dma_address array.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
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);
--
2.25.1
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Nouveau] [PATCH] drm/nouveau: fix dma_address check for CPU/GPU sync
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
2021-06-22 9:32 ` Christian König
1 sibling, 0 replies; 4+ messages in thread
From: Ondrej Zary @ 2021-06-14 16:40 UTC (permalink / raw)
To: Christian König; +Cc: nouveau, bskeggs, dri-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Nouveau] [PATCH] drm/nouveau: fix dma_address check for CPU/GPU sync
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
@ 2021-06-22 9:32 ` Christian König
2021-06-22 13:27 ` Alex Deucher
1 sibling, 1 reply; 4+ messages in thread
From: Christian König @ 2021-06-22 9:32 UTC (permalink / raw)
To: linux, bskeggs, dri-devel, nouveau
Ping? Does anybody wants to give me an rb or acked-by?
AGP is basically broken on nouveu without this.
Christian.
Am 14.06.21 um 13:05 schrieb Christian König:
> AGP for example doesn't have a dma_address array.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> 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);
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Nouveau] [PATCH] drm/nouveau: fix dma_address check for CPU/GPU sync
2021-06-22 9:32 ` Christian König
@ 2021-06-22 13:27 ` Alex Deucher
0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2021-06-22 13:27 UTC (permalink / raw)
To: Christian König
Cc: nouveau, Ben Skeggs, Maling list - DRI developers, linux
On Tue, Jun 22, 2021 at 5:32 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Ping? Does anybody wants to give me an rb or acked-by?
>
> AGP is basically broken on nouveu without this.
Looks correct to me.
Acked-by: Alex Deucher <alexander.deucher@amd.com>
>
> Christian.
>
> Am 14.06.21 um 13:05 schrieb Christian König:
> > AGP for example doesn't have a dma_address array.
> >
> > Signed-off-by: Christian König <christian.koenig@amd.com>
> > ---
> > 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);
>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-22 13:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-06-22 9:32 ` Christian König
2021-06-22 13:27 ` Alex Deucher
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).