Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5550055imm; Sun, 26 Aug 2018 23:14:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbCVzeESatye8Es5NG262Mwku4xTsVHU4783uJ8742WRm+k8xxNF+tAQA+B39o74YRPWbfH X-Received: by 2002:a63:6988:: with SMTP id e130-v6mr11184987pgc.249.1535350499516; Sun, 26 Aug 2018 23:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535350499; cv=none; d=google.com; s=arc-20160816; b=Qqq+IvrBZjgxNkm5739GO03RaL9dID1tiHkFz+QWK/0VmtHcP7oz9wCwwCVd7xdKqm qDhTYHW846Lnb9l0V7tqi7iPH5/WWi+jSJXZPE+mtjToFYFBnoJzQWg5JOYiBhbMEuBL 2AAeKlmIdH8u6ylaQxcl2nqTOzU915vWnQ7K2+z/7cYBDE0aw+m1IFD6ZwkaOEEIMc+G lpCg1hwmW3lhm7SMeaaLdqu2MPVXpw4qDOWWqk5rhxxQTv2h8Hu/fcL8bn1NGx7q3Bx+ 2XaC9OXIxJFojCPWhaZPYoihjimOLLhcYeCjxnE91sy3F6Y58tdfn1/mn+7WFMyfD+tG pmrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=BFpYUEFukRDafpqJ+/VXdSDYP01f81T/1NIrfiZ8PVA=; b=VaJgWeTPTOC98dOyPFx6jJfXl7e/B9W/Ig5SxwGAeeGoBxTW1Hkpxj3BYh1ccdrzfj llaVd403mKojpR7lpo737OJLgPN4tOPrhLItZ2/iKtfEmrwe9i8KMCfopczsz0ByEPJO RvYJrZ7wGLEcrN7WFFPHeD8E4TBWVzWsiJLZCadGFNwSUG/wA5qlJ43P5CXWzGl2waNv i4YgCTtPCEFWLdWntj4PaZK0thLiLj9jTLowGeem58SVLDJX9ua23Qafya+MNvM8iYmw 5klPazaNPlS7nko/RAExiPrrWzr9LE/8U+ot/EGpFubdxT6r1Ap7kXeXmjMAY6+JIRfP ClVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 o33-v6si13833560pld.180.2018.08.26.23.14.44; Sun, 26 Aug 2018 23:14:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726978AbeH0J6v (ORCPT + 99 others); Mon, 27 Aug 2018 05:58:51 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:48214 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726776AbeH0J6v (ORCPT ); Mon, 27 Aug 2018 05:58:51 -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 1fuAmG-0003Vb-DG; Mon, 27 Aug 2018 14:13:28 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fuAmE-00058A-RO; Mon, 27 Aug 2018 14:13:26 +0800 Date: Mon, 27 Aug 2018 14:13:26 +0800 From: Herbert Xu To: "Martin K. Petersen" Cc: Jeff.Lien@wdc.com, ard.biesheuvel@linaro.org, david.darrington@wdc.com, hch@infradead.org, jeff.furlong@wdc.com, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, tim.c.chen@linux.intel.com Subject: Re: [PATCH 2/4] crc-t10dif: Pick better transform if one becomes available Message-ID: <20180827061326.oqclv2sncoayt3al@gondor.apana.org.au> References: <20180825061205.ygrjjazkooqghrqy@gondor.apana.org.au> <20180826024006.13800-1-martin.petersen@oracle.com> <20180826024006.13800-2-martin.petersen@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180826024006.13800-2-martin.petersen@oracle.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 25, 2018 at 07:40:04PM -0700, Martin K. Petersen wrote: > > +static int crc_t10dif_rehash(struct notifier_block *self, unsigned long val, void *data) > +{ > + struct crypto_alg *alg = data; > + struct crypto_shash *new, *old; > + > + if (val != CRYPTO_MSG_ALG_LOADED || > + static_key_false(&crct10dif_fallback) || > + strncmp(alg->cra_name, CRC_T10DIF_STRING, strlen(CRC_T10DIF_STRING))) > + return 0; > + > + spin_lock(&crc_t10dif_mutex); > + old = rcu_dereference_protected(crct10dif_tfm, > + lockdep_is_held(&crc_t10dif_mutex)); > + if (!old) { > + spin_unlock(&crc_t10dif_mutex); > + return 0; > + } > + new = crypto_alloc_shash("crct10dif", 0, 0); You cannot allocate crypto tfm objects while holding a spin lock because they need to allocate memory with GFP_KERNEL. How about using a mutex? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt