[RESEND][PATCH 1/3] dma-buf: system_heap: Make sure to return an error if we abort

John Stultz john.stultz at linaro.org
Tue Jan 19 20:45:06 UTC 2021


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.semwal at linaro.org>
Cc: Liam Mark <lmark at codeaurora.org>
Cc: Laura Abbott <labbott at kernel.org>
Cc: Brian Starkey <Brian.Starkey at arm.com>
Cc: Hridya Valsaraju <hridya at google.com>
Cc: Suren Baghdasaryan <surenb at google.com>
Cc: Sandeep Patil <sspatil at google.com>
Cc: Daniel Mentz <danielmentz at google.com>
Cc: Chris Goldsworthy <cgoldswo at codeaurora.org>
Cc: Ørjan Eide <orjan.eide at arm.com>
Cc: Robin Murphy <robin.murphy at arm.com>
Cc: Ezequiel Garcia <ezequiel at collabora.com>
Cc: Simon Ser <contact at emersion.fr>
Cc: James Jones <jajones at nvidia.com>
Cc: linux-media at vger.kernel.org
Cc: dri-devel at lists.freedesktop.org
Suggested-by: Suren Baghdasaryan <surenb at google.com>
Signed-off-by: John Stultz <john.stultz at 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



More information about the dri-devel mailing list