From patchwork Thu Dec 22 16:37:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 9485359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2E6D9601D2 for ; Thu, 22 Dec 2016 16:41:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2103828066 for ; Thu, 22 Dec 2016 16:41:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15A652816B; Thu, 22 Dec 2016 16:41:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B24EC28066 for ; Thu, 22 Dec 2016 16:41:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cK6PU-0005R1-63; Thu, 22 Dec 2016 16:40:04 +0000 Received: from exsmtp02.microchip.com ([198.175.253.38] helo=email.microchip.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cK6Nu-0003x3-RL for linux-arm-kernel@lists.infradead.org; Thu, 22 Dec 2016 16:38:27 +0000 Received: from tenerife.corp.atmel.com (10.10.76.4) by chn-sv-exch02.mchp-main.com (10.10.76.38) with Microsoft SMTP Server id 14.3.181.6; Thu, 22 Dec 2016 09:38:13 -0700 From: Cyrille Pitchen To: , , Subject: [PATCH v2 10/12] crypto: atmel-aes: fix atmel_aes_handle_queue() Date: Thu, 22 Dec 2016 17:37:59 +0100 Message-ID: <82a83bf030641719067b649d67817dd99e445059.1482424395.git.cyrille.pitchen@atmel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFupiVWLjYuHi8mHRLWOMiTDY82TWFkaLwwunMFo8eN/JYjFt+jtmi3uftjFadExZxeTAGsAQxZqZl5RfkcCa0T6hkb3gCmfF+i0LmRsY/7J3MXJxCAmsY5RYPOcOaxcjJwebgKHE2wdHwWwRgUCJhS2vGEGKmAWmM0o8WP2OHSQhLOApsXJ2K5jNIqAq8eTcImYQm1cgXmLRqyeMILaEgJzEzXOdYHFOAVuJ9XPvAQ3lANpmI3HwrRBEuaDEyZlPWEBsZgEJiYMvXoCVCwmoAe1dwQwxJlDiyf1NULaTxKyfm1kgbDuJw9MvskPY9hKX9l1igam59PEFE4StLbH91T5WCFtHYtvBfqgaW4k9MyZC1bhLPHi0HMr2lZj1sAGqJkridvMu9gmMErOQnDoLyakLGJlWMUo7e/jpBofpukY4exgY6eUmZxTo5iZm5ukl5+duYoTEk9oOxpk9/ocYJTmYlER5t046Hy7El5SfUpmRWJwRX1Sak1p8iFGCg0dJhHfjcqAcb3FBYm5xZjpMSoaDQ0mCNwIkJViUmp5akZaZU5JaBJE+xSgpJc4bDZIUAOnLKM2Dy11iFJUS5o1aCpTjKUgtys0sgYjfYhTmeMgkxJKXn5cqBXQiAxBoML5iFOdgVBLm3Q8yiyczrwTuhFdA1zEBXbdu92mQ60oSEVJSDYxaMfrpnxdcNmR1q7NTubcntP/0+h3btMNdQryOP5zq5awfGHgu5Y3tsfULf/18XbsqLiN4ZrL/bp6kSdx3d60s+3fnjcDrkrLbMm+8st9KOXyI+D8/btOKa3yurbEfZzS3hO+47yNxTyFk7g39o0o9GldsdmY5bzNJUEjfmm8o+y7ZieVWurQSS3FGoqEWc1FxIgCA9TNZHQMAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161222_083827_032690_8275D560 X-CRM114-Status: GOOD ( 10.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cyrille Pitchen , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes the value returned by atmel_aes_handle_queue(), which could have been wrong previously when the crypto request was started synchronously but became asynchronous during the ctx->start() call. Signed-off-by: Cyrille Pitchen --- drivers/crypto/atmel-aes.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 0e3d0d655b96..9fd2f63b8bc0 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -879,6 +879,7 @@ static int atmel_aes_handle_queue(struct atmel_aes_dev *dd, struct crypto_async_request *areq, *backlog; struct atmel_aes_base_ctx *ctx; unsigned long flags; + bool start_async; int err, ret = 0; spin_lock_irqsave(&dd->lock, flags); @@ -904,10 +905,12 @@ static int atmel_aes_handle_queue(struct atmel_aes_dev *dd, dd->areq = areq; dd->ctx = ctx; - dd->is_async = (areq != new_areq); + start_async = (areq != new_areq); + dd->is_async = start_async; + /* WARNING: ctx->start() MAY change dd->is_async. */ err = ctx->start(dd); - return (dd->is_async) ? ret : err; + return (start_async) ? ret : err; }