* [PATCH] drm/nouveau/vm: fix memory corruption when pgt allocation fails
@ 2012-12-20 22:37 Marcin Slusarz
[not found] ` <1356043034-25739-2-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Marcin Slusarz @ 2012-12-20 22:37 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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 <peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
Signed-off-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
index 082c11b..77c67fc 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
@@ -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;
}
--
1.8.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/nouveau/vm: fix memory corruption when pgt allocation fails
[not found] ` <1356043034-25739-2-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-12-24 20:52 ` Marcin Slusarz
0 siblings, 0 replies; 2+ messages in thread
From: Marcin Slusarz @ 2012-12-24 20:52 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On Thu, Dec 20, 2012 at 11:37:09PM +0100, Marcin Slusarz wrote:
> 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 <peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
> Signed-off-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
BTW, this fixes https://bugs.freedesktop.org/show_bug.cgi?id=58087
> drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
> index 082c11b..77c67fc 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
> @@ -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;
> }
>
> --
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-24 20:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20 22:37 [PATCH] drm/nouveau/vm: fix memory corruption when pgt allocation fails Marcin Slusarz
[not found] ` <1356043034-25739-2-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-24 20:52 ` Marcin Slusarz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.