Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp949258ybp; Fri, 4 Oct 2019 07:26:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7hoY/q+SvKYuTUXHC1kUejNeHTZIte1BOSnGgHBLwgWiwRE6PKf5Hoocxnbk8ODq/M3Bx X-Received: by 2002:a50:9f42:: with SMTP id b60mr15860347edf.192.1570199200934; Fri, 04 Oct 2019 07:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570199200; cv=none; d=google.com; s=arc-20160816; b=Caf2Q+0EZQT+60K5A55JLR2uk6jGTGOY0z6vRq3fC2MXP4MwsDetUAYHZjEAfskonC 8nCv3Zs9HRhVQWUVLWrX130hVWSsWS9RnTRRFmIPpsiwLWtlaAjIh9OW/WB+mFEHEOiF Sp1q3ynW9OrjDMf1YOKQRYawBnrGNOt1gS6eIyzpZOvAxPvIYNxEvcujIncytFAwI1ku dKRPCTiiH6ptTuWYW5TziGNGLkg7sWPwgWBnlui4EzDwaMnNy1GFfHqLAHANFxQ8T4K/ wXb+WfDrIZmOU8H+w5APm/LZlmYC/b6Ut6edBySI9zmtcfQsx2Tkq4nsOlNjL/A5jaJp pKHw== 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; bh=Tsqy4Yts9fXyIfIIB0kODlmKy72vxLQjyh9hq8uOaRE=; b=OJ+6+pM9gbbLBqzR0GXh6yiE/X5QRipuSJRC2Sz9rHlTYMvbAkzSOQnEWHQUQY0V2H wTq4skdRKQ8L2zLlP4dP9VasQ2WXNtYYuQBUHix+3TJmkrN7TfKiykjpk7rXCZX6lVpe zL5si1TIK+KYRlOAmfbtmWPw7e62mlaM44o4ZwVIhZEdhUe87vqCdn0Vp81RixbDxM7m Sx1c/VrDYSTn9pnZWUrciw/h86I4XEsf8wvBaf/X3KP6O2W0zlQopdXKkt9B5LeYoQCm DMmURa0VqvLqkyy2miSCcpaJ4xkLRslge1sVxWSvcAMtcKMnBZA5eL1ZzAtLqcWnRra3 C5NQ== 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 z33si4020023edz.314.2019.10.04.07.26.15; Fri, 04 Oct 2019 07:26:40 -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 S1729638AbfJDO0L (ORCPT + 99 others); Fri, 4 Oct 2019 10:26:11 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:42150 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727587AbfJDO0L (ORCPT ); Fri, 4 Oct 2019 10:26:11 -0400 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.0.7]) by fornost.hmeau.com with smtp (Exim 4.89 #2 (Debian)) id 1iGOX0-00075c-PG; Sat, 05 Oct 2019 00:26:07 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Sat, 05 Oct 2019 00:26:03 +1000 Date: Sat, 5 Oct 2019 00:26:03 +1000 From: Herbert Xu To: Laurent Vivier Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Matt Mackall Subject: Re: [PATCH] hw_random: move add_early_randomness() out of rng_mutex Message-ID: <20191004142603.GA29787@gondor.apana.org.au> References: <20190912133022.14870-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190912133022.14870-1-lvivier@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Sep 12, 2019 at 03:30:22PM +0200, Laurent Vivier wrote: > > @@ -496,19 +510,24 @@ int hwrng_register(struct hwrng *rng) > goto out_unlock; > } > > - if (old_rng && !rng->init) { > + new_rng = rng; > + kref_get(&new_rng->ref); > +out_unlock: > + mutex_unlock(&rng_mutex); > + > + if (new_rng) { > + if (new_rng != old_rng || !rng->init) { Is this really supposed to be || instead of &&? > /* > * Use a new device's input to add some randomness to > * the system. If this rng device isn't going to be > * used right away, its init function hasn't been > - * called yet; so only use the randomness from devices > - * that don't need an init callback. > + * called yet by set_current_rng(); so only use the > + * randomness from devices that don't need an init callback > */ > - add_early_randomness(rng); > + add_early_randomness(new_rng); > + } > + put_rng(new_rng); > } Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt