summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2016-08-16 04:17:43 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-09-01 12:10:45 -0400
commit50fec50bffea22dc6c19c86da6ecb604c940c424 (patch)
tree69b7a865e06b6f13118d5e2b8c510703f716aad8 /drivers/gpu/nvgpu
parent3b6819bdf4e4802dbd1c0fc840382816935121ed (diff)
gpu: nvgpu: fix memory leak in case of failure
In __gk20a_alloc_pages(), if we fail to allocate a chunk we free previously allocated chunks in error path But we do not free up the memory reserved in those chunks which could lead to OOM situations Fix this by calling gk20a_free() for each chunk in error path Jira DNVGPU-96 Change-Id: I68aa18d68a5282405016e688c790ccbc0c2a0d69 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1203098 (cherry picked from commit f096bd1675600f4e2fc2d686f2911bb945fbbf0b) Reviewed-on: http://git-master/r/1210952 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c
index 534027cc..521a87b3 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c
@@ -200,6 +200,7 @@ fail_cleanup:
200 c = list_first_entry(&alloc->alloc_chunks, 200 c = list_first_entry(&alloc->alloc_chunks,
201 struct page_alloc_chunk, list_entry); 201 struct page_alloc_chunk, list_entry);
202 list_del(&c->list_entry); 202 list_del(&c->list_entry);
203 gk20a_free(&a->source_allocator, c->base);
203 kfree(c); 204 kfree(c);
204 } 205 }
205 kfree(alloc); 206 kfree(alloc);