From patchwork Wed Jun 28 07:22:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 106499 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp686933qge; Wed, 28 Jun 2017 00:22:14 -0700 (PDT) X-Received: by 10.98.158.139 with SMTP id f11mr9261420pfk.208.1498634534429; Wed, 28 Jun 2017 00:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498634534; cv=none; d=google.com; s=arc-20160816; b=Y6z2tuCjAEIE1WnOvDt+CMnOEOXKQcKOErCj5Oiu9vRgDnd9o/WsMmlFVk64NuuqWy OY7zgpb8JwS4ZQoe1Og56iHVw1jfS09ao1l18/Aa9t1Rajsm/S46CPcf6+b4ruold4ti iOrMRx9u6HFr+KWwzyXRMZK/5vpxZdccfp8gIc6jsPce5z1fsxEkvszVZQ3QgiBdtvnO wiIOuk60Q5IAotX9zJ8lfqiITiayaJLGedh8IzJ57/ox0lA12SAwB5A76D4uh3//tAja GkaCOhuj1Yp8pd/cTPmolttC9SprSF9VbMwvZoRGPeKhEBWeHSCQCUmbnC/PqiE/vJVt DFHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=v1S3y3eA5nq79GTMaxRcqnEliIC/LdsFivJ6Z0S9u4Q=; b=uHZ+1BAYWP7MkqrTF9Na4neByxTTryvx+A0BQuzzt+s4Ge2se1g0VTaM4KWgVP08o8 pXsW/g+YQmOlDTK13Gy9FyMELdZn1VHPVa5TlqHw0n8dA8CzDboYwI+50OOiVOcnlwBu WJOExsJHf/zQ4B2eelJl9GeuzaL+SBzjDxxGmdWESfdbBDKNzUiHnIuadCE9FDCvT4At Vp813qfMzNlh5B247iT0BYJOxWS4u/WVXNXeocVXhIu39/4cb+VgoxjJLHSrrytVugL2 GV3fWDV0w7qj28iuZGpvld5XEYyrZtM4dflEB+5v2xuDCW2br1yhiqV1KJnlzyE1PJ5j dj+A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i61si1187447plb.383.2017.06.28.00.22.14; Wed, 28 Jun 2017 00:22:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751551AbdF1HWM (ORCPT + 1 other); Wed, 28 Jun 2017 03:22:12 -0400 Received: from foss.arm.com ([217.140.101.70]:37820 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbdF1HWL (ORCPT ); Wed, 28 Jun 2017 03:22:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 36D58344; Wed, 28 Jun 2017 00:22:11 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8D7A43F557; Wed, 28 Jun 2017 00:22:09 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ofir Drang Subject: [BUGFIX] crypto: atmel: only treat EBUSY as transient if backlog Date: Wed, 28 Jun 2017 10:22:03 +0300 Message-Id: <1498634523-2660-1-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The Atmel SHA driver was treating -EBUSY as indication of queueing to backlog without checking that backlog is enabled for the request. Fix it by checking request flags. Signed-off-by: Gilad Ben-Yossef --- Please note I do not have access to the hardware or know it very well, so this patch was only compile tested. I ran into this while working on a crypto API change and it seemed wrong. Please review and test if you can! drivers/crypto/atmel-sha.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.1.4 diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index a948202..dad4e5b 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -1204,7 +1204,9 @@ static int atmel_sha_finup(struct ahash_request *req) ctx->flags |= SHA_FLAGS_FINUP; err1 = atmel_sha_update(req); - if (err1 == -EINPROGRESS || err1 == -EBUSY) + if (err1 == -EINPROGRESS || + (err1 == -EBUSY && (ahash_request_flags(req) & + CRYPTO_TFM_REQ_MAY_BACKLOG))) return err1; /*