Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp216767pxx; Wed, 28 Oct 2020 03:06:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxTF7oyoE6ko80wDLtWDx5Evh/ZqB9piOhYnPfnSAqEhUrrsYQUjM+G50VL+EPDBD6UCbt X-Received: by 2002:a17:906:141b:: with SMTP id p27mr7002484ejc.205.1603879618382; Wed, 28 Oct 2020 03:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603879618; cv=none; d=google.com; s=arc-20160816; b=gW096eR2+PArr2mvpOUdHs3KmgzzmvhN1VovnKtsKZFdlKwpp1EaOao3FKNajH2X2s k/qfsBKqAQns3uJKDHH9zDFRx5vS8VldRA5X75gUD8twxGBIzrH2CxKo6E+e4EDW8OeU eo0Wbiig7we9T7t0BcYjtKY9FkkTjnxbhzl44SpE3wybcFRMxGiIAJncLGhV3ZqMdgoy TzXO8hPlQlmeZoiJpYhOkVADfDPWBTPEdFTQLa6a5J9i6iftP7rkC4XRTSS/hpBSr0pO RKmRkCQ9+K/7H43Ak1FHdbvPwFiXOzIfnGwO+/rwOKG1AagJGM2GL0QSbmsnB0ustn76 wUCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OmSSh1/Adwky8GX+yc/0DQ/RhmENdXv5SzvFll0Xs9I=; b=Yt5danGI4+ZWkKthv/imuzD9Mvleb8GlCZ0fyO3jtoO3hFys9OYiO3Ja+lpKFT15w1 UppupXAX7a/lYB8KOZvrDBpkW96LphJCGD9qEZDHxG26RE9y8i0nzV2hfeN3APt64T+I gCWclRMJtCGKmCiqlIT4ANmZM5AMjteTVihS8hPej4JR8YlgnQu+YtErlN6Wbmr1jEJo H50EKbjSl8ygtMTZPjCoC2lwQZiDHr/g3+hWMashhEuZhSM4JD2YY25aS5wlznWaxoz7 95obAXu8TUiJZtvgF9+hs192SIaIJRi0NU0S9eUHiyVmTjstHz7lqrzwO1Dow2YPlfV+ UwWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PHCkkQ5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si2705925ejr.482.2020.10.28.03.06.35; Wed, 28 Oct 2020 03:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PHCkkQ5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760212AbgJ0OeA (ORCPT + 99 others); Tue, 27 Oct 2020 10:34:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:58888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759279AbgJ0OcD (ORCPT ); Tue, 27 Oct 2020 10:32:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EA7222202; Tue, 27 Oct 2020 14:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809122; bh=BUOhf/KhDDkfbOeeQln3sQwrnmCVU5E+id99mlkoif8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PHCkkQ5hcLmIoAOKzFIzWazjmN0HXocCCYOr88c0gw3oXhZrpNCF/Sf1Fpy6mWCBG D6wIkj3J/a5gS/tBG8qngc1AD7Akk5O2+4CbrZBJxTPLgMTS+1ollfdr9sKJVw7kqW DjlPDo0L0lekvPfKVCn50PyCZgVOAy/Wsj03Nznk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herbert Xu Subject: [PATCH 5.4 053/408] crypto: algif_aead - Do not set MAY_BACKLOG on the async path Date: Tue, 27 Oct 2020 14:49:51 +0100 Message-Id: <20201027135457.529906824@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Herbert Xu commit cbdad1f246dd98e6c9c32a6e5212337f542aa7e0 upstream. The async path cannot use MAY_BACKLOG because it is not meant to block, which is what MAY_BACKLOG does. On the other hand, both the sync and async paths can make use of MAY_SLEEP. Fixes: 83094e5e9e49 ("crypto: af_alg - add async support to...") Cc: Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- crypto/algif_aead.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c @@ -78,7 +78,7 @@ static int crypto_aead_copy_sgl(struct c SYNC_SKCIPHER_REQUEST_ON_STACK(skreq, null_tfm); skcipher_request_set_sync_tfm(skreq, null_tfm); - skcipher_request_set_callback(skreq, CRYPTO_TFM_REQ_MAY_BACKLOG, + skcipher_request_set_callback(skreq, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL); skcipher_request_set_crypt(skreq, src, dst, len, NULL); @@ -291,19 +291,20 @@ static int _aead_recvmsg(struct socket * areq->outlen = outlen; aead_request_set_callback(&areq->cra_u.aead_req, - CRYPTO_TFM_REQ_MAY_BACKLOG, + CRYPTO_TFM_REQ_MAY_SLEEP, af_alg_async_cb, areq); err = ctx->enc ? crypto_aead_encrypt(&areq->cra_u.aead_req) : crypto_aead_decrypt(&areq->cra_u.aead_req); /* AIO operation in progress */ - if (err == -EINPROGRESS || err == -EBUSY) + if (err == -EINPROGRESS) return -EIOCBQUEUED; sock_put(sk); } else { /* Synchronous operation */ aead_request_set_callback(&areq->cra_u.aead_req, + CRYPTO_TFM_REQ_MAY_SLEEP | CRYPTO_TFM_REQ_MAY_BACKLOG, crypto_req_done, &ctx->wait); err = crypto_wait_req(ctx->enc ?