If we abort from the allocation due to a fatal_signal_pending(),
be sure we report an error so any return code paths don't trip
over the fact that the allocation didn't succeed.

Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: Liam Mark <lm...@codeaurora.org>
Cc: Laura Abbott <labb...@kernel.org>
Cc: Brian Starkey <brian.star...@arm.com>
Cc: Hridya Valsaraju <hri...@google.com>
Cc: Suren Baghdasaryan <sur...@google.com>
Cc: Sandeep Patil <sspa...@google.com>
Cc: Daniel Mentz <danielme...@google.com>
Cc: Chris Goldsworthy <cgold...@codeaurora.org>
Cc: Ørjan Eide <orjan.e...@arm.com>
Cc: Robin Murphy <robin.mur...@arm.com>
Cc: Ezequiel Garcia <ezequ...@collabora.com>
Cc: Simon Ser <cont...@emersion.fr>
Cc: James Jones <jajo...@nvidia.com>
Cc: linux-me...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Suggested-by: Suren Baghdasaryan <sur...@google.com>
Signed-off-by: John Stultz <john.stu...@linaro.org>
---
 drivers/dma-buf/heaps/system_heap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma-buf/heaps/system_heap.c 
b/drivers/dma-buf/heaps/system_heap.c
index 17e0e9a68baf..405351aad2a8 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -363,8 +363,10 @@ static int system_heap_allocate(struct dma_heap *heap,
                 * Avoid trying to allocate memory if the process
                 * has been killed by SIGKILL
                 */
-               if (fatal_signal_pending(current))
+               if (fatal_signal_pending(current)) {
+                       ret = -EINTR;
                        goto free_buffer;
+               }
 
                page = alloc_largest_available(size_remaining, max_order);
                if (!page)
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to