drm/nouveau/vm: fix memory corruption when pgt allocation fails
Subsystems (3)
PATCH 1/1 drm/nouveau/vm: fix memory corruption when pgt allocation fails
If we return freed vm, nouveau_drm_open will happily call nouveau_cli_destroy, which will try to free it again.
Reported-by Peter Hurley <[email protected]>
Signed-off-by Marcin Slusarz <[email protected]>
--- drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/core/subdev/vm/base.c +3 -1
@@ -352,7 +352,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,u64 mm_length = (offset + length) - mm_offset;int ret; - vm = *pvm =kzalloc (sizeof (*vm),GFP_KERNEL ); + vm =kzalloc (sizeof (*vm),GFP_KERNEL );if (!vm)return -ENOMEM ;
@@ -376,6 +376,8 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,return ret; } + *pvm = vm; +return 0 ; }
Signature · 1 line
1.8.0.2
A message that is not in the archive (sent off-list or not yet received): 1356043034-25739-2-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 6 lines · Marcin Slusarz
If we return freed vm,
nouveau_drm_openwill happily callnouveau_cli_destroy, which will try to free it again.Reported-by Peter Hurley <[email protected]>Signed-off-by Marcin Slusarz <[email protected]>---
BTW, this fixes https://bugs.freedesktop.org/show_bug.cgi?id=58087
Quoted 26 lines
drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/core/subdev/vm/base.c +3
-2@@ -352,7 +352,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,u64 mm_length = (offset + length) - mm_offset;int ret; - vm = *pvm =kzalloc (sizeof (*vm),GFP_KERNEL ); + vm =kzalloc (sizeof (*vm),GFP_KERNEL );if (!vm)return -ENOMEM ;@@ -376,6 +376,8 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,return ret; } + *pvm = vm; +return 0 ; } --