From patchwork Tue Jan 19 20:45:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 366216 Delivered-To: patches@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1100484jam; Tue, 19 Jan 2021 12:45:12 -0800 (PST) X-Received: by 2002:a65:620f:: with SMTP id d15mr2174201pgv.218.1611089112608; Tue, 19 Jan 2021 12:45:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611089112; cv=none; d=google.com; s=arc-20160816; b=D+JpdZbep0iEbTU8N2EQSakjP8btjMSZ8tzHlNE8SIJk8Ohjo8ZWDtfiXH9E7Zbi/S Hv9L5hEU7/3qRj6lIhrO/9RU4HJ+bnCiVnPY1d2rJk5GKszYjPk2eyeXcj76pWeE+SWe 9TDoesN/mIfEaNtzbBDevEiAv5l0AYaYTYZlYrfLucCYOv2O6Qrx/Co8duRHLvF0s2rX oyY0sM0kmGoU6iwnoE51gZfXSvfYdvZiYrIEYx29M/UqxHckWBuYToBBRgKUgz9mA9C0 QpCQTwkykgVMGjzSMmpcZ2JRJRxdyOoqPupCdCiYo6eeqFp9YE3E6uLpTIMV6F2554Ne wMtQ== 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=cFtjbfEqFFurLklaLXCRhdYYYo20XVRW7vaPhz7S+PEmPncqHxB5RrrASAcJYG2Tke o8036yGo9ayR4akAVWhGMTRijHtngrnlyKMVoshU4ZwThxHPaGKyFkBa389IkGwZggWq utga3Nm9tkC44OEju0Df6EVOjDxxfE/FJgj3RrzF+4P4ou9kSu0pDbYBz0vheYKlovJd 5fGzraE3wdvZSef+DxWeYSXcohZBBob+ECyuFzIFjS2GI56jbd1PzJQ+WCqenlFMV1Ky sribVMLprWAq/O7KaqCS2DJtSFt9de5FvxDei4IhPBFFbUGX+a9syMpdTU2I0CHXPpVo yaUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BOomRcty; 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 x26sor14543pfo.40.2021.01.19.12.45.12 for (Google Transport Security); Tue, 19 Jan 2021 12:45:12 -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=BOomRcty; 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=BOomRctyxyEqp6sAYPFH+XcCAixJ9mdS3M4PS9Y1Hs6E8tPpzPoXFJ7GtEq0ZqmFX/ bvhzR+TJgZVMqHH0HGzclpgi6jHb4tp/UtdkQysgd8hBfqUTrR17Y6FjSOhJWQ2F65jI r1SvnCIuGt5FEZtRnmIoXeTeKg9AnfvEJ8THUXkDay1yIct1VropoKQyZoua/576XOuD HIzDN4aSMbE4zlQfV44ERRSILhcgU3FKtUKbczAlrE/k83vWca3WhG+5a8lAddZX2g8Q Z5jTjcfBLXAGwxTXTJE5Rl1C1/t5U+IzOftefmhcvZTXwPrIAFUJ7fNQJ0hP5B+sqD5A ke+w== 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=OO/bfMD5XeUcjfn8FojvTs9SxwZuF4JdOpIF2xFI/00gWl26AmfxTrikNHEoKACj6H yduhvh/MRPSkPHEqOQVt4EsijDDbmSQPCEVyvL2ou6DzSvXQ0R1U88Hv43M5NphEhx/Q YgoJv1IgwNz7KwmWcEhVvVHBF1lWdrdZsN7cdBawV0zOEKtFVyI/QQeBBzOdx6nE/Xm1 /nlTcswwh9vwP8qLd9ZxPhUW5fC1ZEaA0SNoWjjE2N1U7SDqyQ+aFuSn68xzAJJQ34Jl vZbHwK33ogqiDQW2ExOUgIc0Rguoc5Pe65Bs8tDYwk3fs/2Sb5OclgY+MY4YCxAi47ug RMxg== X-Gm-Message-State: AOAM531rlx+OGBsBmqTeY3JG3iCXMDQwXWnyoNUYzCqbfgkYDf3Lf6N4 DWvAeqWwWTCgb1FSrNrkxti2LuLJ X-Google-Smtp-Source: ABdhPJzu4DX94t/qf1W5DtWbi8rKWJWe4eKwpUf4bPI5rvqgtbBrSK+Jq+SaY8+fAOZRUOFW+e520A== X-Received: by 2002:a62:36c3:0:b029:1b9:e110:e126 with SMTP id d186-20020a6236c30000b02901b9e110e126mr3294942pfa.64.1611089112103; Tue, 19 Jan 2021 12:45:12 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id md7sm4129838pjb.52.2021.01.19.12.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 12:45:11 -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: [RESEND][PATCH 1/3] dma-buf: system_heap: Make sure to return an error if we abort Date: Tue, 19 Jan 2021 20:45:06 +0000 Message-Id: <20210119204508.9256-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)