aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2011-08-22 23:14:05 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-03 11:40:14 -0700
commit045451f9de4d9b7a7a961bf2428b990edf543271 (patch)
tree0daaed22d2f41ba461837f1fa37e1f62b8621ee3
parent766357153d2e17eff9bf45ed66bff015472c1159 (diff)
downloadkernel_samsung_crespo-045451f9de4d9b7a7a961bf2428b990edf543271.zip
kernel_samsung_crespo-045451f9de4d9b7a7a961bf2428b990edf543271.tar.gz
kernel_samsung_crespo-045451f9de4d9b7a7a961bf2428b990edf543271.tar.bz2
drm/nouveau: properly handle allocation failure in nouveau_sgdma_populate
commit 17c8b960930da3599e47801a54ac0ea1070545d2 upstream. Not cleaning after alloc failure would result in crash on destroy, because nouveau_sgdma_clear assumes "ttm_alloced" to be not null when "pages" is not null. Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sgdma.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
index 82fad91..ca6028f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
@@ -37,8 +37,11 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
return -ENOMEM;
nvbe->ttm_alloced = kmalloc(sizeof(bool) * num_pages, GFP_KERNEL);
- if (!nvbe->ttm_alloced)
+ if (!nvbe->ttm_alloced) {
+ kfree(nvbe->pages);
+ nvbe->pages = NULL;
return -ENOMEM;
+ }
nvbe->nr_pages = 0;
while (num_pages--) {