Commit f020b443 authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Greg Kroah-Hartman

gpu: ion: fix use-after-free in ion_heap_freelist_drain

The `buffer' variable is being used after being freed. Fix this.
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db866e3d
...@@ -200,9 +200,9 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, size_t size) ...@@ -200,9 +200,9 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, size_t size)
if (total_drained >= size) if (total_drained >= size)
break; break;
list_del(&buffer->list); list_del(&buffer->list);
ion_buffer_destroy(buffer);
heap->free_list_size -= buffer->size; heap->free_list_size -= buffer->size;
total_drained += buffer->size; total_drained += buffer->size;
ion_buffer_destroy(buffer);
} }
rt_mutex_unlock(&heap->lock); rt_mutex_unlock(&heap->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment