From ed776185eca52c6ed044a45f42c61d50a1803dc6 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 10 Jun 2015 13:53:23 -0700 Subject: gpu: nvgpu: Check for split_order > max_order When choosing an order of buddy to start splitting from (happens when no buddies of the requested alloc order exist) don't sit in the while loop past max_order. This makes no sense and hangs the system. Bug 1647902 Change-Id: I6900597d24944d3170bc76cd75f33794b07707d1 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/756591 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a_allocator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c index b6549cee..3694c96d 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c @@ -604,10 +604,11 @@ static struct gk20a_buddy *__balloc_find_buddy(struct gk20a_allocator *a, static u64 __balloc_do_alloc(struct gk20a_allocator *a, u64 order, int pte_size) { u64 split_order; - struct gk20a_buddy *bud; + struct gk20a_buddy *bud = NULL; split_order = order; - while (!(bud = __balloc_find_buddy(a, split_order, pte_size))) + while (split_order <= a->max_order && + !(bud = __balloc_find_buddy(a, split_order, pte_size))) split_order++; /* Out of memory! */ -- cgit v1.2.2