Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3246163ybg; Mon, 28 Oct 2019 09:42:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyawKrkIuU4BPt9l3MB8mv+5C+kPrt/RZqYRyVdxuo2b1ckWpWVvTDygQAePsZWxScX7PZX X-Received: by 2002:a17:906:2f83:: with SMTP id w3mr2965178eji.57.1572280933370; Mon, 28 Oct 2019 09:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572280933; cv=none; d=google.com; s=arc-20160816; b=VbOrNqWk8aHBe+x63cQSykKX7RgL9ZMzzl40b+N/mzjFLfN7AQX/qKIdIiliDxUNTl EUmCwh5C5zoI1JHrjbKb0TVtYz11QxW8ATXX5GR1vOVcKgRq8IwQrQtyalIIYomABeTj qxYnq8tWfyZZxLhqMBYw0os+Edy3G4MHAoVLkgrMU2qEoY90J06Wauqy7vCEO950d2a5 FCLm1SB9A6dKsDZWFaW95Smlm0VjxsgxwG35upWYgBSsQPPo2HCivm6TFlLbCa36hDu9 FBOdkyClj62hWTKE51jBA5+EkMlbbl2ggO0f4XjtFCdQiKk0e+YAoodYpQr8r/lx3gi8 BpIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date; bh=666rtHJD6J2dxqxk0wJv7bcb3lMHPkG4SSLTh7oPIos=; b=B14HPk4shMHYuuX4c7cHj4jgA3GtbzE6IgBsV3kWEuFSb/JyD6FCrdJNCvc9M8thWt 6a0YDdlPqMi6Qvfs2Zq+KCOCvrbDGWKv3xb8cE68JMdY189I6R38QCgVASMGVeQyNTGp pedT5I8unhhppemB72wwvYv7iT2wzKZQOVQwTz0YDNIdoE1fOHJf1PDUJsupjoIKXpZV qp8vkzDC1Wt3cJHet5O4IggcmbHpxV7vi10CYQ4gehNHf3AqWP5Je044aMgS0ZxKNUT2 FLzilm+N3FyalFwQgG4jont/ccX9BTQXF6RbSgnJDbpucp2lFuJ8cCLDj8vwpwiXCtLU chlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si9072554edf.79.2019.10.28.09.41.47; Mon, 28 Oct 2019 09:42:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733275AbfJ1IYh (ORCPT + 99 others); Mon, 28 Oct 2019 04:24:37 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:51094 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729786AbfJ1IYh (ORCPT ); Mon, 28 Oct 2019 04:24:37 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1iP0KK-0001Em-2p; Mon, 28 Oct 2019 16:24:36 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1iP0KH-0002w1-Ep; Mon, 28 Oct 2019 16:24:33 +0800 Date: Mon, 28 Oct 2019 16:24:33 +0800 From: Herbert Xu To: Harald Freudenberger Cc: linux390-list@tuxmaker.boeblingen.de.ibm.com, linux-crypto@vger.kernel.org, ifranzki@linux.ibm.com, ebiggers@kernel.org, freude@linux.ibm.com Subject: Re: [PATCH] s390/crypto: Rework on paes implementation Message-ID: <20191028082433.qdaabj2imf34ikam@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191028073731.11778-1-freude@linux.ibm.com> X-Newsgroups: apana.lists.os.linux.cryptoapi Organization: Core User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Harald Freudenberger wrote: > > @@ -165,18 +183,31 @@ static int ecb_paes_crypt(struct skcipher_request *req, unsigned long modifier) > struct skcipher_walk walk; > unsigned int nbytes, n, k; > int ret; > + struct { > + u8 key[MAXPROTKEYSIZE]; > + } param; > > ret = skcipher_walk_virt(&walk, req, false); > + if (ret) > + return ret; > + > + spin_lock(&ctx->pk_lock); > + memcpy(param.key, ctx->pk.protkey, MAXPROTKEYSIZE); > + spin_unlock(&ctx->pk_lock); I think using a plain spin lock is unsafe as you may have callers from both kernel thread context and BH context. So you need to have at least a spin_lock_bh here. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt