drm/nouveau/mmu: Fix an UAF issue in NVKM
Subsystems (3)
PATCH 1/1 drm/nouveau/mmu: Fix an UAF issue in NVKM
From: Xinghui Li <[email protected]>
In nvkm_mem_new_host, the mem is be alloced. And mem->memory is assigned to pmemory. During this process, the mem will be free if the error occurs. But the *pmemory still points to the &mem->memory which has been relased.Laterly, the nvkm_memory_unref will put the memory which points to the pmemory again.So, we set the *pmemory to NULL to avoid UAF issue.
--- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c +1 -0
@@ -185,6 +185,7 @@ nvkm_mem_new_host(struct nvkm_mmu *mmu, int type, u8 page, u64 size, }else if ( (ret =nvif_unvers (ret, &argv, &argc, args->vn))) {kfree (mem); + *pmemory =NULL ;return ret; }
Signature · 1 line
2.31.1
hi all
friendly ping...
Quoted 31 lines · <[email protected]> 于2023年1月12日周四 15:18写道:
From: Xinghui Li <[email protected]>
In
nvkm_mem_new_host, the mem is be alloced. Andmem->memoryis assigned to pmemory. During this process, the mem will be free if the error occurs. But the *pmemory still points to the&mem->memorywhich has been relased.Laterly, thenvkm_memory_unrefwill put the memory which points to the pmemory again.So, we set the *pmemory to NULL to avoid UAF issue.Reported-by loydlv <[email protected]>Signed-off-by Xinghui Li <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c +1
-1@@ -185,6 +185,7 @@ nvkm_mem_new_host(struct nvkm_mmu *mmu, int type, u8 page, u64 size, }else if ( (ret =nvif_unvers (ret, &argv, &argc, args->vn))) {kfree (mem); + *pmemory =NULL ;return ret; } --2.31.1