From patchwork Thu Jan 7 21:15:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 358296 Delivered-To: patches@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp812960jai; Thu, 7 Jan 2021 13:15:29 -0800 (PST) X-Received: by 2002:a63:5309:: with SMTP id h9mr3691964pgb.19.1610054129133; Thu, 07 Jan 2021 13:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610054129; cv=none; d=google.com; s=arc-20160816; b=tKUBnMFx0JZSDiQg8SLOR0WNvX17fULhTj900zJezp7XFF3GycSxVqTz5FyhH41Wyi CTEP8tv2zwh62CxMgV2qOD+vyOf5xUJVTTrQE+tiEeaaJ6cLZDbEX51j5fCtuglDBxuq gO8BXvuK+ARgZAdDZVyHvGR3qmComgPQaUNNFSzxsSkyDj8RgTtqZ4a/Xh5PojgbgO84 +TcUXl61vUyCEHh/nRzhAsBR6u01xp1golAMv9t08aJLiyrjBDXFpQu2NFcdw8o+r3as yguG14kR3VduK4YpU7QYtEALlqm6kih63U20PZ/s/1QCkXuL1bPadR0LTUFRKyYV7z1/ jDQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=/gCsWuNpJqoaKmXUbqD2yoFjbhOP/NQNls4IpQYcF/Q=; b=FTAn6tX6wkcmEQ0QKuyAi3ulA9SuRWNhXJltKYYDPl9lyUMuSaNZ5QsUALNRiLU8++ 9CGZGQ50ivKYEm1GtYXqHE1IQRcTT8gAyn9od/l/RjduT8dBS8lOYpRIgL7OZpY+UcqU FACcuKuknkC6BpoevKCH28zhVaAwPD4PuloBb7pdEc3m/6x6HjKZvXNS0djYseQKcagv VeX+ylZHhnO91Pvg6TSYmhSTEcp+v0P1luiFdrn1wmcwJe8ply9no/1ZTPo/SuPfsSyd fHxlBm72uKw7Q/KsSBH9rCtc/rlWkbXQS9lJR7/b+KhufDwZ8Ka5NmQCMevnNhoIRefC 2btQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K8BGJ9oH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id m29sor3718592pgb.74.2021.01.07.13.15.29 for (Google Transport Security); Thu, 07 Jan 2021 13:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K8BGJ9oH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/gCsWuNpJqoaKmXUbqD2yoFjbhOP/NQNls4IpQYcF/Q=; b=K8BGJ9oHdqpLDSsv4ZzOKEHEpyQXmBiqo3CQDjAFOiubf8uMAXb8rE+2Q+8w+MuenT r39dpZHy1UjTwLvLcHtkgKqx7m1yH/VZCVvUsyblpu4gsHE8oyEh27knqvqkNx99hfd/ OdLjIgReRKvwFliH9XDPaVNHEjCr8ivL1CuAOS5SsvSCJwjtqzf9bEeTilTgDDB91z1d d8gKjlz+Dsl9OtsTbJ+dMP1JwATb4Hb+DNbBTib+6EpAlAhzwgHklh5i6ggogkXvBu0w Sl0lvmy8kDpa3UVvGMnYPvuuD5pjaQCOY4j8xR9yncAL6VXY3VpNQLEDm0Rk5MWF1r7S 80MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/gCsWuNpJqoaKmXUbqD2yoFjbhOP/NQNls4IpQYcF/Q=; b=IOv3Ofxr1w8Q0RMoN73tUTpXowOYRHKrE+SYmyjkewrg+yPrcpnuo75XNXtl8vV49A REPdLT/MbyhYdFKQi/Ypy81Vqzunvrb4KCYDKHgvfBNLP73zG0TjvMmQRsLstE3EuU7P i2FESCKRdW2Ey5I4zcFgB1n8WR3tq1+x3jVf6niR5h6s/I3xGPcFU1mfWW5XFY42avRV r57hA9gQFELiuykYlUxzWBQpSjKqTrrTt96pgxK+sS8HjJoFBvU+T+zciB2c0vq1WKrG vdKAlyK7PFl7xKepCtrxxLf51hchET1q3OIX8QTSwZv6AvhyjL4Xjw02dxhkgF9GMaUx UiuA== X-Gm-Message-State: AOAM532pWw+J+qFUeYXdHMZZPQQEudMyT0atdRqQ3rghMi3k46E3Y7/q n37x6eQQH1Ggbg3T2i7UGKI5fNru X-Google-Smtp-Source: ABdhPJw+uBkf603u8DBtRcPFLax4GUhUMXlfkuBYTBlYX9IqNd80YY3GhmwaHOU9hi8B00BuqmRrDQ== X-Received: by 2002:a65:6249:: with SMTP id q9mr3744816pgv.82.1610054128730; Thu, 07 Jan 2021 13:15:28 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id b6sm6574055pfd.43.2021.01.07.13.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 13:15:27 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Sumit Semwal , Liam Mark , Laura Abbott , Brian Starkey , Hridya Valsaraju , Suren Baghdasaryan , Sandeep Patil , Daniel Mentz , Chris Goldsworthy , =?utf-8?q?=C3=98rjan_Eide?= , Robin Murphy , Ezequiel Garcia , Simon Ser , James Jones , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] dma-buf: system_heap: Make sure to return an error if we abort Date: Thu, 7 Jan 2021 21:15:23 +0000 Message-Id: <20210107211525.75951-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 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 Cc: Liam Mark Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Chris Goldsworthy Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Suggested-by: Suren Baghdasaryan Signed-off-by: John Stultz --- drivers/dma-buf/heaps/system_heap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1 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)