From patchwork Tue Dec 15 22:05:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 344031 Delivered-To: patches@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp4264530jai; Tue, 15 Dec 2020 14:05:26 -0800 (PST) X-Received: by 2002:a17:90a:46c2:: with SMTP id x2mr679216pjg.15.1608069926132; Tue, 15 Dec 2020 14:05:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608069926; cv=none; d=google.com; s=arc-20160816; b=MwbjLQhdW0QgaPP0fBMxPSKRdpXWe7RKOs9J2RfWNIHEl0nOK2hTFuN7hPSrjmZsm6 tTdxwANacFTEdu5NpwHtdjV3uWmdatWhxBGB59wPSoeidroo0SyErzki0hJZt7wjP/un 8S2t+RJ9BENFS/1RFg3Al10k4yRbP0jbXX/k6ewQolQ1fcoEM2RhvFyG6k5gb3E460Ky EuN3J5fPMSw55+acWUfldRJ+WSrtR2G80K5lfLG6rWsSiuoPRO1Z5gOlOP+qP8V8t85i KFRZZR3QZKRseJTpvJFiFFQA3xTrblCFLXz78Xdfe6xozbAHuFGemnInEKO0I1i4Dc63 ugvw== 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=LiPm55vRmQB/yBtMc9dWDosG+dFYU20xJIv1RC7Tiqgor51ROpve66niCJ8he/IwWk 02bU2/XxQhJk+ZNe4dZLZMtE12K461VIlflJPhm7xuod6zLcGuO3OahosR5ckRJys8cX 5XGokW8tj1LEXgxMnBvwDEl+DfyeuvmvtLaUfuJnWjviTiHbpAIn8Ey4YFll8GS+E5ij 7WCySyC688dYwWzS8+i+GlXImtaMyIQglEuVsXrE7NjdF8HEfxpuaxibvesTVqTKcOB/ O2JQ5pfBR85Mr6tHR7fUgDpdFVi7bLIN1f3vhsDNo9hUUOiw8uv3Y2WRobusQTF9vSvD /vGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rOu3z9tr; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 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-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v31sor55670pga.36.2020.12.15.14.05.25 for (Google Transport Security); Tue, 15 Dec 2020 14:05:26 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rOu3z9tr; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 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=rOu3z9tr+Uz2Jq7hQygYWUdSEXOtqllnYQZVQ7JZLP52v4jZtyPKuSCT0emQd928OS UXnG68BiLFVU5IQzQhttHl4AmSfyq4yDqbxhYhiij0OuDGBNjOHsxUQJOL2bjrjqpAA3 uWLxYS3XwS/5mzazbiFvZa8vT/fuF5R7qmq50x7vmbOV2O0fmGldMo5W7lynABBr46/z bUU18S0qjd5J8Cj4Jmtk47WRhH5lFCVNVOcfyk1aUkZnOwqy1g+wjd+OoHh/xSMjOz4o YI4ePM8sxnDoE3XI1Dkz0kH4YFQI6OJrdUOOEzkWr32/V/3WusqocYedGiK/BTdQyysH iD8A== 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=k8sjUZZhoKzU7GZUks/T6hBD0LGYGROEF9KUp0Ly7ziIlwV2/2Fzgkt3BGCw9HRweX fbHtI3wrZTYb/hBHLRX7nsybyXKTJqmn8BdcGGLBzLZHhPCTg4+nDpuSwXK/cZGqN5bb 4h5MEnfzAIu/TVgm8/hFyG1Nk6hZKCPuRdiUhXaW37948yxoeLsWm3cBUPRKY8tqFUxp rEngaBiiiKO64sWmEXncfEanYD+7C1Q27lcBtlqmcjGCObknEg858z8akEv2t2GzjcQV joEAl9nrKT4kyVlrbDWOXVICq3M7HM/Lp9Bytedq3iGolWTuDCvv3HjMosiSfvfiwMCG hY6A== X-Gm-Message-State: AOAM531vPbDejuFWOi8Vw/dVa0vxifiRhUQdRm7e9q5IZ229JcG7mhgO UVP7N0YpiLOd3LM9OOK7MlL2TtD7 X-Google-Smtp-Source: ABdhPJy/bv/dpSXnrXAIXAKPU25FtDrutI9TAwJhbjpo2R/NbvcsZmowxwswu/mRJpZaOEHPVHm+Fg== X-Received: by 2002:a63:4e4c:: with SMTP id o12mr30386525pgl.348.1608069925721; Tue, 15 Dec 2020 14:05:25 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id x15sm84146pfa.80.2020.12.15.14.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 14:05:24 -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: [RFC][PATCH 1/3] dma-buf: system_heap: Make sure to return an error if we abort Date: Tue, 15 Dec 2020 22:05:19 +0000 Message-Id: <20201215220521.118318-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)