From patchwork Thu Jan 26 16:07:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 9539663 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 4EE66604A9 for ; Thu, 26 Jan 2017 16:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E74F26E96 for ; Thu, 26 Jan 2017 16:14:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3350027D4D; Thu, 26 Jan 2017 16:14:22 +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=-1.9 required=2.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CA5D627D4A for ; Thu, 26 Jan 2017 16:14:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cWmgm-0001UD-F5; Thu, 26 Jan 2017 16:14:20 +0000 Received: from smtpout.microchip.com ([198.175.253.82] helo=email.microchip.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWmgU-0000xP-Fy for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2017 16:14:03 +0000 Received: from tenerife.corp.atmel.com (10.10.76.4) by chn-sv-exch06.mchp-main.com (10.10.76.107) with Microsoft SMTP Server id 14.3.181.6; Thu, 26 Jan 2017 09:13:41 -0700 From: Cyrille Pitchen To: , , Subject: [PATCH v3 10/12] crypto: atmel-aes: fix atmel_aes_handle_queue() Date: Thu, 26 Jan 2017 17:07:55 +0100 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFjrMKsWRWlGSWpSXmKPExsXCxeXDomuq0BVhMGP6wuO8Fve+n2e2mHO+hcWi+5WMxabH11gt7t/7yWRxedccNotvl5vZLaaeXsviwOGx4NdWFo9PV64weWxZeZPJY9sBVY/NS+o9Pm+SC2CLYs3MS8qvSGDNaJ/QyF5whbNi/ZaFzA2Mf9m7GLk4hATWM0o83n6ctYuRk4NNwFDi7YOjYLaIQKDEwpZXjCBFzALrGCVamt8ygySEBTwlpj+7zQ5iswioSrRuWQHWwCsQL/H6aAMTiC0hICdx81wnWD2ngK3Eyl+r2UBsIQEbie47bxkh6gUlTs58wgJiMwtISBx88YIZokYNaPEKZog5gRLP7v2Fmukk8X/lTHYI207i8PSLULaDxP37M9hgag5ufQ5la0tsf7WPFcLWkdh2sJ8FwraV2DNjItRMd4kHj5ZD2b4Ssx42QNVESZzq/8w6gVFiFpJTZyE5dQEj0ypGaWcPP93gMF3XCGcPAzO93OSMAt3cxMw8veT83E2MkBjN3sF4ZH7EIUZJDiYlUd6b2p0RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR498t1RQgJFqWmp1akZeYAkwVMmomD8xCjBAePkgjvRJAa3uKCxNzizHSI/ClGSSlx3k6QhABIIqM0D673EqOolDDvaVGgHE9BalFuZglE/BajMMdDJiGWvPy8VCmgOxmAQIPxFaM4B6OSMO9VkFk8mXklcDteAa1nAlp/gbkdZH1JIkJKqoGxtG2zh3VbBHu8geXUySF/9z4Vs3vSrK5y4FrVjO43uT6vA6Onx91fonBVLjJv36GQvUc2/ZdlmCx0ZvL9taIB+w2zfv9jO+HxzkrH5Wrqt447bLIMljqO6m+2OZ5S3Ohzs9Rs/nXPm7e7d/U9WVEQKTdX2/ya9b7ov8ssNJ/Whb1Mqd+79JC6EktxRqKh FnNRcSIAsHhZzFYDAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170126_081402_566738_0E5B0669 X-CRM114-Status: GOOD ( 10.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: smueller@chronox.de, 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; }