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: 9539687 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 46D3D604A0 for ; Thu, 26 Jan 2017 16:15:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3718B27D4A for ; Thu, 26 Jan 2017 16:15:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BFDB27F07; Thu, 26 Jan 2017 16:15:47 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFCED27D4A for ; Thu, 26 Jan 2017 16:15:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753841AbdAZQPe (ORCPT ); Thu, 26 Jan 2017 11:15:34 -0500 Received: from smtpout.microchip.com ([198.175.253.82]:35469 "EHLO email.microchip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753671AbdAZQOu (ORCPT ); Thu, 26 Jan 2017 11:14:50 -0500 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: , , CC: , , , , Cyrille Pitchen 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= Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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; }