From patchwork Fri Jul 21 15:42:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 108488 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp943956qge; Fri, 21 Jul 2017 08:43:08 -0700 (PDT) X-Received: by 10.98.73.65 with SMTP id w62mr8102885pfa.61.1500651788065; Fri, 21 Jul 2017 08:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500651788; cv=none; d=google.com; s=arc-20160816; b=OPx6BX6yvo+wMPP4cJd0Bs+JGZelFZxloDNVByh5NayXNzdyYib2wiVspOSzjJZ54g KGH5MEvpxe3vE8sRoT78NsKkibfwCKyB66+aNHIxbUa9jQGFw2WOfE4qJ6JMnvfoDjbt 37HIff+//51y7KQ/oLNCgJ6YXT8esbeKGDkE6asKPPKQvfHogEBf2FQZpp21WKeP7RxI oGM7l5TI8hkWAEeX6jacCRanhMgSHfMjjXgUxgBt69mSXdhK1RTYIDCUkqiD6dYz3Z2Y uzGV2BtkUduN3K+h886vUWtTWOsbakhm7H9ghcBsBwycBRHGcQri3+dxchq5+BgG0g/W amoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=hqZ3r1HCHF4DUlY1SsDnOPxDmdJivPKzLq2NZGCvHiY=; b=YUF+4gk/siGPvkuA5uCtUNOqKYftGe+s4Hf1vow/s9q32cOOrO2LYZp88qwUAf6tO/ dfa87d8VOoMv83nU740Dni6PYszl0GyWaQ/M3YvojtR9Tmslmx2+lOjbbOJt9kfYVdT+ GIMgBT1AKEm0A9wwSRftvIB5J3bfICqaI9PnZxbn0I5mIxXceEOGyyYRmbtyjgjQmSpP IPAaA1HcOaBX7FOXhYSppeVvjdqw/Eh3ZwGa874lRALz6k2lAY/pqRJj916ElpNPox/R Ps0XE7DQDPwACs3H7m8Xy5pZ2DL87AoLT4CbmxZDMw2M438dhYEifGRpTNbrhEK4Q7A1 v/EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=NnuNuPuH; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si1422656pld.973.2017.07.21.08.43.07; Fri, 21 Jul 2017 08:43:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=NnuNuPuH; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817AbdGUPnC (ORCPT + 1 other); Fri, 21 Jul 2017 11:43:02 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35653 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751760AbdGUPm7 (ORCPT ); Fri, 21 Jul 2017 11:42:59 -0400 Received: by mail-wm0-f41.google.com with SMTP id w126so15912767wme.0 for ; Fri, 21 Jul 2017 08:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hqZ3r1HCHF4DUlY1SsDnOPxDmdJivPKzLq2NZGCvHiY=; b=NnuNuPuH2q6YUDwDCNzqohBwKGOhs3T/eFPLzUib8MPu3+XLikfht/fzcW5e/3umTl tErAaBfQVby+MYtaUPhtVsGj+peFIQp+d5xfrdkTvQiN0QCnwqhvBmZnLNkWwZCEHi9o 1+EwUaMaQuZBDrQTUkBtg3+/DsmSY/GOFC4xg= 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:in-reply-to :references; bh=hqZ3r1HCHF4DUlY1SsDnOPxDmdJivPKzLq2NZGCvHiY=; b=Rp/1JHiqp5au8Y+gmsWYM2XX1IkoLP/DxVdmtf/vGv/V6p69MS6hPXzGU134v+oQNW 7pqIIbvpCNCXgkNQz5BZYYv1ysTY3EMR4bU0vHxvA1+1zsC0FvQ8xXJ95tcHO47JuurA 7IPTr8uZDNa532MA4jv2aI7izpXPvL/Sq98GE2EGg9IvkXD4isP7pLNXBTjyApLS6IxK eq5KlbvcU6VEC9JwvwnIbvZe6TGxE739yWmLZvoWulWvLsTY142hY+/EuuDe07/bDVGd 0vJ51Jygy0Keyp/tMtGo5oObpV4rWIgEdwDMsGBpQ6lLWJFu5DJVrc6v9xwzCk4xxAhN YLgg== X-Gm-Message-State: AIVw113alXQj57ih9Wtxhh6ktx4ZWYQBLUXbiugc/VBjKaWxiPNRgoqD lOXiKE0AjcnsY0z+i7Vwjg== X-Received: by 10.28.230.199 with SMTP id e68mr5276966wmi.139.1500651777818; Fri, 21 Jul 2017 08:42:57 -0700 (PDT) Received: from localhost.localdomain ([105.148.195.69]) by smtp.gmail.com with ESMTPSA id f203sm1498563wme.39.2017.07.21.08.42.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jul 2017 08:42:57 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, giovanni.cabiddu@intel.com Cc: Ard Biesheuvel Subject: [PATCH v2 1/3] crypto: scompress - don't sleep with preemption disabled Date: Fri, 21 Jul 2017 16:42:36 +0100 Message-Id: <20170721154238.21697-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170721154238.21697-1-ard.biesheuvel@linaro.org> References: <20170721154238.21697-1-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Due to the use of per-CPU buffers, scomp_acomp_comp_decomp() executes with preemption disabled, and so whether the CRYPTO_TFM_REQ_MAY_SLEEP flag is set is irrelevant, since we cannot sleep anyway. So disregard the flag, and use GFP_ATOMIC unconditionally. Cc: # v4.10+ Signed-off-by: Ard Biesheuvel --- crypto/scompress.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.11.0 diff --git a/crypto/scompress.c b/crypto/scompress.c index ae1d3cf209e4..0b40d991d65f 100644 --- a/crypto/scompress.c +++ b/crypto/scompress.c @@ -211,9 +211,7 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir) scratch_dst, &req->dlen, *ctx); if (!ret) { if (!req->dst) { - req->dst = crypto_scomp_sg_alloc(req->dlen, - req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? - GFP_KERNEL : GFP_ATOMIC); + req->dst = crypto_scomp_sg_alloc(req->dlen, GFP_ATOMIC); if (!req->dst) goto out; }