Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3956936pxm; Tue, 1 Mar 2022 08:29:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzx6cVnIxgzSam0uCpBaSea6lNO4j67wN1krgVwgSyOwhU+ro5/QTOhDFCyJ0UOO1aHkcay X-Received: by 2002:a17:906:3104:b0:6ce:6b85:ecc9 with SMTP id 4-20020a170906310400b006ce6b85ecc9mr19530628ejx.339.1646152141811; Tue, 01 Mar 2022 08:29:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646152141; cv=none; d=google.com; s=arc-20160816; b=I4aMengGmyTZlvMoO24PcBjK1yG086e3nxtG+6YxheenH97yzFaX0Z6zsJHubDmuXm jq0L16Tu2/kQEBY/FGTu9J0Nr3ZJ4MYRETadnAmVVqDBqLORtOXND1rb1mjINTUM4nqK 6gtkUojvDbXmA5vGBc8ZpM3rJvGc/Y32JCyTlSAcb9NQurX0UiamfAXRskXKQh256uy6 xu9UOPtvk/Z9l5Duhs2rTRYASh0ZAz9w7WfBGxHWt0GfU2HrzEbB0ho9pxfBudZ1yAL/ BRZJDzHNLQldqISQABLho7wr4zSzAnpbLSf2iux03I9ub3wSKBEcWfoWLNPh2hfD/fnt 1S7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=6WhAa+YOXGltoyMqcX7N0VnItSTAZJK1gkc405nTTaA=; b=gSZexG39zi55zx6E5X/Co2j5QQAMw4jMB4mjLzVZX28E2NtHnJEbHzVW55MmK0PjRy YXxoVqjKH6YLscsgjsDOrc1pBNqzY+ZbqHZ5oP+RvJBEVjUnIXqPUqZxpoaDfi6heCtd Qa5t6XZ9bH6E8HIxkym88FGbUwQr6J14e3Q1vJjPOnFFe3lRCZpy9gl+BoZKwq/W08hX zCy2DQvwQDTOBZRkq5lwxdViXgOGjGcWlZwuwsIwAsckEsw433vgd8O1WyNVTzogzVM3 T/QXocwqF1AE2DJbVm/D9TKZe0Ove2AiTOxu0/HFSNP7Lo9G53w1sm8EdDqx+fS+qNPg TrnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=U7y+jA6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020a509d41000000b00412d2c6da85si9052244edk.501.2022.03.01.08.28.37; Tue, 01 Mar 2022 08:29:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=U7y+jA6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236120AbiCAQTJ (ORCPT + 99 others); Tue, 1 Mar 2022 11:19:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231880AbiCAQTI (ORCPT ); Tue, 1 Mar 2022 11:19:08 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7E4027FC1; Tue, 1 Mar 2022 08:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646151485; bh=GE6GS19/67yYeeIDztfYNxsDMH/T0wk4DthhRy8ejPU=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=U7y+jA6LdTzJujUMK3dzljwv/P/RPSkc8GYdzn/zT29MiYk/TXclPyIt2WkLzo3Fz QaaeABGOQNTaHqKx6l9jTgCBWGH8ff0yIVxJSqFHkiQh1IWmXHDKxrnKWZ7pbkGtab msMU4JCkCx9xKfdLNzgbkjIVDlSvO1qeVpZuRwCk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.74] ([149.172.237.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mlf4c-1o6hTS2tr0-00ikHQ; Tue, 01 Mar 2022 17:18:04 +0100 Subject: Re: [PATCH v8 1/1] tpm: fix reference counting for struct tpm_chip To: Jason Gunthorpe Cc: peterhuewe@gmx.de, jarkko@kernel.org, stefanb@linux.vnet.ibm.com, James.Bottomley@hansenpartnership.com, David.Laight@ACULAB.COM, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, p.rosenberger@kunbus.com, Lino Sanfilippo , stable@vger.kernel.org References: <20220301022108.30310-1-LinoSanfilippo@gmx.de> <20220301022108.30310-2-LinoSanfilippo@gmx.de> <20220301140544.GF6468@ziepe.ca> From: Lino Sanfilippo Message-ID: <65c85c5e-f1ec-c5fe-7477-e28ce2528fd4@gmx.de> Date: Tue, 1 Mar 2022 17:18:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220301140544.GF6468@ziepe.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:nwAQctVcgl9fE4nGE+wKXBDsYDQCaWgBIA8cXCrisbPkeQt47B2 nmPKtjZcElnwaihQ7+vMokf2+J5s3bYyh2knjZxeZD8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1zqZejdQ2Vrlwq5wCEXAcIyT6MVIqHSYfs1RrTxMisdccjcFwBl1TFsc5i2as SrkAJaiK4AJWlMTS1QrkTj7AziOKmYCGm7YQuOiSgmvpCq3rnhfQ6TiKDFvakk208/7b44ciI pVNbXCXuKGhCxEJUudOQMh4hRTd/pU2NUdCxLPrU68IwDVcbT11LFYlQDeiBPwR/I/0mZrwXG bmV2Pu4FFcnBFA= X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org On 01.03.22 at 15:05, Jason Gunthorpe wrote: > On Tue, Mar 01, 2022 at 03:21:08AM +0100, Lino Sanfilippo wrote: >> @@ -653,8 +623,10 @@ void tpm_chip_unregister(struct tpm_chip *chip) >> if (IS_ENABLED(CONFIG_HW_RANDOM_TPM) && !tpm_is_firmware_upgrade(chip= )) >> hwrng_unregister(&chip->hwrng); >> tpm_bios_log_teardown(chip); >> - if (chip->flags & TPM_CHIP_FLAG_TPM2 && !tpm_is_firmware_upgrade(chip= )) >> + if (chip->flags & TPM_CHIP_FLAG_TPM2 && !tpm_is_firmware_upgrade(chip= )) { >> cdev_device_del(&chip->cdevs, &chip->devs); >> + put_device(&chip->devs); >> + } > > I would put those two lines in a function bside tpm_devs_add() as > well, more modular. > Agreed, I will put this in a tpm_devs_remove() function as counterpart to = tpm_devs_add(). Regards, Lino