Skip to content

Commit 6c27ffa

Browse files
author
Ben Skeggs
committed
drm/nouveau/ttm: avoid using nouveau_drm.ttm.type_vram prior to nv50
Pre-NV50 chipsets don't currently use the MMU subsystem that later chipsets use, and type_vram is negative here, leading to an OOB memory access. This was previously guarded by a chipset check, restore that. Reported-by: Thomas Zimmermann <[email protected]> Fixes: 5839172 ("drm/nouveau: explicitly specify caching to use") Signed-off-by: Ben Skeggs <[email protected]>
1 parent 630f512 commit 6c27ffa

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/gpu/drm/nouveau/nouveau_bo.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,13 @@ set_placement_list(struct nouveau_drm *drm, struct ttm_place *pl, unsigned *n,
350350

351351
if (domain & NOUVEAU_GEM_DOMAIN_VRAM) {
352352
struct nvif_mmu *mmu = &drm->client.mmu;
353-
const u8 type = mmu->type[drm->ttm.type_vram].type;
354353

355354
pl[*n].mem_type = TTM_PL_VRAM;
356355
pl[*n].flags = flags & ~TTM_PL_FLAG_CACHED;
357356

358357
/* Some BARs do not support being ioremapped WC */
359358
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA &&
360-
type & NVIF_MEM_UNCACHED)
359+
mmu->type[drm->ttm.type_vram].type & NVIF_MEM_UNCACHED)
361360
pl[*n].flags &= ~TTM_PL_FLAG_WC;
362361

363362
(*n)++;

0 commit comments

Comments
 (0)