Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1868077rwb; Fri, 2 Dec 2022 02:11:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf4LaIrjAsNH865wvs4iOVm5kPoZlDbyU0xOeppKY0lbt2Z1QdeHT69mIMBz1gj4n+sXWJ+T X-Received: by 2002:a05:6402:3808:b0:468:c911:d843 with SMTP id es8-20020a056402380800b00468c911d843mr63974410edb.422.1669975892058; Fri, 02 Dec 2022 02:11:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669975892; cv=none; d=google.com; s=arc-20160816; b=arya803RMujKJCj8/a8yQf4FiNKb0/EstQ13uZEIiHJBDlZbwKd1A1o6F64gaNqnXf 59MX+3m7Q1LazmzRfGfyXihj1cUfm1HyOgw4RGV/Lg1xN3YB0rvYwO9vCeDN7A08jEd5 eu5bjPZY1cNIoZ3PTDrsGPE82LOO3j4ts+oFFEOhKE1DRwZ2YYWKHbaUVviELIsLRV0T q+5Trhlnco6Se7SFgmDO+Teh+mC/ywkEnxSxC0HTo3H1Ww53Wc5ijja6ixqhRXHfQbOr 1uZMFaPb051e1iPsrRcaxPAmIu5grgvZlsQa3FlZy7UKKGTduKpDPDcdV03d/ENNZeBu GOxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=jX+P1k84nKCTd3ofjmeDXBjRtACMvA5Kke6l9gr3Guc=; b=gCgBgpQeMtO65P8YkbHWo12kg4fOY+wfMADDfZ0U2/H7hSCtEOLUJs91LrA3ApGPCv Xzv12vHy/uYkUN4hUy+cJHcZRtAwT25fhTMB1ueceuvaUsX6v52ViZmdJhJmOo+6T3dI DFksNE1+JARZ/EZbRZPgK0wc5VjaK7UO5qH86J3S8MQ1F1W4ErFkYXUMvd2YfgsKqnbh eKMGEPSsayM4buPambHg7yl3ybqbACAo7SvXL/TMp1ITv5emnUzcJaP7DiHW47wsZW2V 0Ud9JRagMi8fvd9VM9VJbC2MdOlR71oestTSUVcrl3prw1qK1f7SZYp9OGtuAsFsNXbN 9Xyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu14-20020a170906eece00b00783ac0b4d32si5972460ejb.941.2022.12.02.02.11.07; Fri, 02 Dec 2022 02:11:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232662AbiLBJm2 (ORCPT + 99 others); Fri, 2 Dec 2022 04:42:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232598AbiLBJmL (ORCPT ); Fri, 2 Dec 2022 04:42:11 -0500 Received: from formenos.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24698B2740 for ; Fri, 2 Dec 2022 01:42:10 -0800 (PST) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1p12YR-003BNL-Jt; Fri, 02 Dec 2022 17:42:00 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 02 Dec 2022 17:41:59 +0800 Date: Fri, 2 Dec 2022 17:41:59 +0800 From: Herbert Xu To: Xiongfeng Wang Cc: olivia@selenic.com, mpm@selenic.com, mb@bu3sch.de, linux-crypto@vger.kernel.org, yangyingliang@huawei.com Subject: Re: [PATCH] hwrng: amd - Fix PCI device refcount leak Message-ID: References: <20221123093949.115579-1-wangxiongfeng2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221123093949.115579-1-wangxiongfeng2@huawei.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Nov 23, 2022 at 05:39:49PM +0800, Xiongfeng Wang wrote: > for_each_pci_dev() is implemented by pci_get_device(). The comment of > pci_get_device() says that it will increase the reference count for the > returned pci_dev and also decrease the reference count for the input > pci_dev @from if it is not NULL. > > If we break for_each_pci_dev() loop with pdev not NULL, we need to call > pci_dev_put() to decrease the reference count. Add the missing > pci_dev_put() for the normal and error path. > > Fixes: 96d63c0297cc ("[PATCH] Add AMD HW RNG driver") > Signed-off-by: Xiongfeng Wang > --- > drivers/char/hw_random/amd-rng.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) The driver geode-rng seems to have the same problem, could you please fix that as well? Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt