Message ID | 20210614110517.1624-1-christian.koenig@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/nouveau: fix dma_address check for CPU/GPU sync | expand |
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);
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);
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); >
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);
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(-)