From patchwork Sun Oct 29 20:39:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Mueller X-Patchwork-Id: 10031659 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 A4200602D6 for ; Sun, 29 Oct 2017 20:40:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93BCD22380 for ; Sun, 29 Oct 2017 20:40:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84189286F2; Sun, 29 Oct 2017 20:40:07 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED 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 125EB22380 for ; Sun, 29 Oct 2017 20:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+U9yNM66Ay5rhyaDxmjTvjRvpF7jiEiUYR9y8mzr4eU=; b=entlWEkwNx8nMp h7jAkS6rMqJuq8SZsJv+gP8mplACyklT4qbJtFPBrZ3AsIg+/PygCn5SconCjpoeIYRXFYyWZjRlw Nyt9dxLSfsI7yl+Kaw4G13vh00iIx6LnC8/EZHEAhlx0QhqKsv3J9WPEtuFxsYALB2NM3ohYP096y VNi2yUIDkwavw9wel5rt90zPNqZ6ScK5dGS7qiH7uxOf9dFDH1XYVre/GNUICJk2U44AYBNTPu3te rAE8ZTUOQ01uWxP/jhhixjY4hB1qcmbAQIzQRyWukvyo/EMZSQ6zUVdwiZxlbAMjcHa3D/f58DP5p YrA/DntXpnKtuoforJsw==; 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 1e8uNK-00011M-6R; Sun, 29 Oct 2017 20:40:06 +0000 Received: from mail.eperm.de ([89.247.134.16]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e8uNE-0000Mb-Ln for linux-arm-kernel@lists.infradead.org; Sun, 29 Oct 2017 20:40:04 +0000 Received: from positron.chronox.de (mail.eperm.de [89.247.134.16]) by mail.eperm.de (Postfix) with ESMTPA id 1610418160CA; Sun, 29 Oct 2017 21:39:32 +0100 (CET) From: Stephan =?ISO-8859-1?Q?M=FCller?= To: Romain Izard Subject: [PATCH] crypto: AF_ALG - remove locking in async callback Date: Sun, 29 Oct 2017 21:39:30 +0100 Message-ID: <5260911.ZuXsrgFD2R@positron.chronox.de> In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171029_134001_165705_6AD0A584 X-CRM114-Status: UNSURE ( 8.12 ) X-CRM114-Notice: Please train this message. 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: Herbert Xu , Tudor Ambarus , Cyrille Pitchen , linux-crypto@vger.kernel.org, linux-arm-kernel 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 Am Mittwoch, 25. Oktober 2017, 17:26:31 CET schrieb Romain Izard: Hi Romain, the patch below should cover the issue you see. Would you mind testing it? Thanks Stephan ---8<--- The code paths protected by the socket-lock do not use or modify the socket in a non-atomic fashion. The actions pertaining the socket do not even need to be handled as an atomic operation. Thus, the socket-lock can be safely ignored. This fixes a bug regarding scheduling in atomic as the callback function may be invoked in interrupt context. Fixes: 2d97591ef43d0 ("crypto: af_alg - consolidation of duplicate code") Reported-by: Romain Izard Signed-off-by: Stephan Mueller Tested-by: Romain Izard --- crypto/af_alg.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 337cf382718e..a41f08642eee 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -1063,8 +1063,6 @@ void af_alg_async_cb(struct crypto_async_request *_req, int err) struct kiocb *iocb = areq->iocb; unsigned int resultlen; - lock_sock(sk); - /* Buffer size written by crypto operation. */ resultlen = areq->outlen; @@ -1073,8 +1071,6 @@ void af_alg_async_cb(struct crypto_async_request *_req, int err) __sock_put(sk); iocb->ki_complete(iocb, err ? err : resultlen, 0); - - release_sock(sk); } EXPORT_SYMBOL_GPL(af_alg_async_cb);