Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp574554pxx; Wed, 28 Oct 2020 11:27:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxge8fMY/tcDSLjYynN4t2to9bR3oOJPM/TMr6/TfPqHlrKMgsc8vhWS3q6bQnDaY4OLXMD X-Received: by 2002:a50:e79d:: with SMTP id b29mr190304edn.57.1603909649604; Wed, 28 Oct 2020 11:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603909649; cv=none; d=google.com; s=arc-20160816; b=qrrw8yVxP2u/c58e5gKJtJvIE2VZpOYeTvBj1AT8huf+/AMAJE9wBl3xrY9wf3GzrX s5q9Mo6+qUzbARtxfFI2cpcUNiAWNx0/Yksdkt+F4Y6n0Spb/Umr+t8P/MI0CUgfGNuK WokWoemzLOVxRh6XLjdA91VVJdQMkrQgQnbYQWWxdOnG/UziMvlBVG0MZhkRqByjN4Fv T+R5nuD5PoUKn3FycT4Ps+JK+nI57DV9DP3hLiXqNYsU+KKm0WJKG2SoKIp/awvT2yWr D3INhbAc49gamoOD1Y15dSmGV7NCdOaSzJWLsn1qq/TXgRAh0sn/xWlJt6sw1Rx/oxS7 9i6g== 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=zNU2yNfMw55CAyzGDkCIDw26aleIcS4Tt+RPOqLoWLU=; b=iuPnFr05Dg0brHJsWzpqZPvfHGQkoQUoQJWIyLOHyY126d+7tYfcJudScFsh+cOkMw hsHL5krXQ/jhhS5pG5uw6BKuUg4Q552/em++RmTQGhBfMefoMQZVmUOh3fbJaM3QReEH gdrnOv6f72arZzqPJoEIxmiLVSOQ4v6ue+lpJWgJwnsHfMj3pzERx22K1gCfk16gZz2N m6LDQ8nu6mpiriy/60x5Vw5EFEP4QUQ3mzO0SgX+YJ4L0kT4cO2R1Hk4UIX7Q0wRgkNp CTtGN+IcSuGR3OnkMWgasEEWrmbk3FCxubLXH5YHXu2PGCa4L4TG7gRZgWTWTFpxAFlW dyUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RevrPZ5b; 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 ay1si32292edb.3.2020.10.28.11.27.07; Wed, 28 Oct 2020 11:27:29 -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=RevrPZ5b; 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 S1824967AbgJ0SHJ (ORCPT + 99 others); Tue, 27 Oct 2020 14:07:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:41328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2900989AbgJ0OSC (ORCPT ); Tue, 27 Oct 2020 10:18:02 -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 16EAB206F7; Tue, 27 Oct 2020 14:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808281; bh=Tk8C1GrbdQd/CECe15DII0+4Q4HysbQV19DljzhAFcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RevrPZ5bBy/jM+V6rWVuYL0bLYGMT/+DVUzNxvSiIrxjWtHSJ0GD4DWK9mYmf7ong Cb5FX1nOaW87aL+B4LMBUQuHbNPa7TAd8wmb3mpWgDYY6NeVXZ8SEuOoYV7NnF2vv8 miUbI0BOGHkc5mGHmq5MBZVdak8vTI7hY6cb0WNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herbert Xu Subject: [PATCH 4.19 032/264] crypto: algif_aead - Do not set MAY_BACKLOG on the async path Date: Tue, 27 Oct 2020 14:51:30 +0100 Message-Id: <20201027135432.167360619@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135430.632029009@linuxfoundation.org> References: <20201027135430.632029009@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 @@ -82,7 +82,7 @@ static int crypto_aead_copy_sgl(struct c SKCIPHER_REQUEST_ON_STACK(skreq, null_tfm); skcipher_request_set_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); @@ -295,19 +295,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 ?