Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1278175rdh; Mon, 25 Sep 2023 08:07:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE97hRMoG+/PQEU6rXbmgvuE01XjQJ7YoEjZwAkJctCeY2vmuG/Et++e1d+qjgZzadUfxk8 X-Received: by 2002:a05:6358:2496:b0:143:7a89:a8e8 with SMTP id m22-20020a056358249600b001437a89a8e8mr8901896rwc.10.1695654474596; Mon, 25 Sep 2023 08:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695654474; cv=none; d=google.com; s=arc-20160816; b=eBh7VvhFvuV+z+O9qNMsP25fvBH0n232784YIil/X+c1NR6qQ7246sdHok8qdvfD0b Uu1ygc/z3pGfQnq0SPuxp6sR73VKW1cYf4YfKrXmxNLCM+lVxNd60Zo6rlr+eTh5aJrD eKNpujM0dRglYDJHSn/6I0siDRC1pkE0q/rmktpk/TsB/OYDeSc0dXyfoAbvP498vHgP oxaw4ZNh4hIzijQ26jrebHK5K19oAbvuC0S0lB4grcpO4FwClR0fcSM4BsCcOWT5nAC4 zPupFge66b92tLwpQkh3M/sQ5Q0qSUbzzskHQypWthMJvjPxrVuH50ARY8EEn3wEMflG QR3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=/4krLnuHsQeAPByRBvjHuH/fv6+zG/tGKZuldPspnVI=; fh=rudv5WYcL/4cDpFmd4JWOXx7ETI/1IaSlM+am2oTnPU=; b=B+GbzAnrVUx+hyxbC6/3k0EDu2xM9b502YPsdDJNbRWjwZubH8fRsz1e8jaZULOyOv 54uY6I+9JxR5uKrL9F76/QNp4V5lHcPT2kS9IuJtJ4FNhNnGh7oiYg1qgt/9PoNzF9SR UBtpM5Ns2MmJ2flYRFkPzEXIpcYfZOCGHhPRK1CV99VFFGQE0Yan2W9JF6tTUcVThmkw sfOkCF1r7IYnOJiU3Xn1gPkltLen6BOzM0rGUg2Wjt5KSjHYpy1LP9SRKAjiqVmiji2Q jte6pZuILHlakE/kBJNO9SAaUGdrlHwZZcOd8Zko59oLNjgzoKgrbFHFbEJ00dvSmw5s 4Sww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id l186-20020a6388c3000000b0056a1ed17deasi10025355pgd.675.2023.09.25.08.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0E7E48157DDE; Mon, 25 Sep 2023 08:07:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbjIYPHQ convert rfc822-to-8bit (ORCPT + 99 others); Mon, 25 Sep 2023 11:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjIYPHP (ORCPT ); Mon, 25 Sep 2023 11:07:15 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86989101; Mon, 25 Sep 2023 08:07:09 -0700 (PDT) Received: from kwepemd200001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RvR2Z3LZZzNnmH; Mon, 25 Sep 2023 23:03:18 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by kwepemd200001.china.huawei.com (7.221.188.2) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.23; Mon, 25 Sep 2023 23:07:07 +0800 Received: from dggpemm500006.china.huawei.com ([7.185.36.236]) by dggpemm500006.china.huawei.com ([7.185.36.236]) with mapi id 15.01.2507.031; Mon, 25 Sep 2023 23:07:06 +0800 From: "Gonglei (Arei)" To: Herbert Xu , "linux-crypto@vger.kernel.org" , Halil Pasic CC: Marc Hartmayer , "Michael S. Tsirkin" , Jason Wang , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "pizhenwei@bytedance.com" Subject: [PATCH] crypto: virtio-crypto: call finalize with bh disabled Thread-Topic: [PATCH] crypto: virtio-crypto: call finalize with bh disabled Thread-Index: AdnvwZyqMOU4LXJLQHSIVFGYJFXR5Q== Date: Mon, 25 Sep 2023 15:07:06 +0000 Message-ID: <1914739e2de14ed396e5674aa2d4766c@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.149.11] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:07:13 -0700 (PDT) Doing ipsec produces a spinlock recursion warning. This is due to not disabling BH during crypto completion function. Fixes: 59ca6c93387d3 ("virtio-crypto: implement RSA algorithm") Reported-by: Halil Pasic Signed-off-by: Gonglei --- drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 3 ++- drivers/crypto/virtio/virtio_crypto_skcipher_algs.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c index 2621ff8a9376..19e2898977d3 100644 --- a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c @@ -61,8 +61,9 @@ static void virtio_crypto_akcipher_finalize_req( vc_akcipher_req->src_buf = NULL; vc_akcipher_req->dst_buf = NULL; virtcrypto_clear_request(&vc_akcipher_req->base); - + local_bh_disable(); crypto_finalize_akcipher_request(vc_akcipher_req->base.dataq->engine, req, err); + local_bh_enable(); } static void virtio_crypto_dataq_akcipher_callback(struct virtio_crypto_request *vc_req, int len) diff --git a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c index 23c41d87d835..661c1102583e 100644 --- a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c @@ -566,9 +566,10 @@ static void virtio_crypto_skcipher_finalize_req( AES_BLOCK_SIZE, 0); kfree_sensitive(vc_sym_req->iv); virtcrypto_clear_request(&vc_sym_req->base); - + local_bh_disable(); crypto_finalize_skcipher_request(vc_sym_req->base.dataq->engine, req, err); + local_bh_enable(); } static struct virtio_crypto_algo virtio_crypto_algs[] = { { -- 2.23.0