Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp415940pxm; Wed, 2 Mar 2022 00:47:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfvgFQbzp+lajafmTIQd98WdVWH1Fh3KAXMpgqSJyUd8V1PMVvLxcE3p3U4pgTottTaO0J X-Received: by 2002:a17:902:9682:b0:14f:ea72:cae9 with SMTP id n2-20020a170902968200b0014fea72cae9mr29926157plp.62.1646210836103; Wed, 02 Mar 2022 00:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646210836; cv=none; d=google.com; s=arc-20160816; b=H84MgUpjwJ2EyEHE836jMfdvLzUNzlThAY4i8GRK7f7cqhRte4vKa+QqQSc/j7GWRG YcXbpjb33ff6w/ZaJ8BlMqqZTR2Q6tp0MFdbtOCP7zOf4wiWJfXUZINWkmmxcZxzjUhx jMjKBGN5IlLalE/92V9O5XXjljsxTLncSp55W+MWKLu/6FHJAtSoie4H/JjmwLLDBx/2 FzE/7cudij+VihwdxDz1IbzTuQug9skOWI0YTl5gvvDJoUD90CDkBzHHqbAeTeAXCljd JnIrDxpLKhArba9qGHoSZsJL3pEdYaEi6ngouetDPY9V73ul+i5B/Av/C6SWJBj/DXcD wsnA== 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:dkim-signature; bh=wtjizohg2CiwaFsaFvPT2wpJpMfkgawgg3Rxz5LmFXY=; b=esHULRPsBPNVmiFd3y85JSTgqHKeGD5PXXObbiTHABSL8wKrsT1VD5DM812KhSWObG sfkP8oCTTtbo24hIYSMD78NEYOxZzInBqfCbDdPPEMCpl63xdv3obgLC0WdKniH8/qBF UEIfEEiOBc8N1+eW9kO/2/Fg6FP0FRkv0OYDCRv5HvrdoH68J5aCfaLsk9owhX6+ia1q Fh3HEMLAqZ2tQaV7pt6lSgSed5iYCarCZvDEZWxzE8SmXP14SwEGfro8cHhmL7yzcWN+ W3aaD4ZT3fJQpi2e6QbExdTk4hrk/wjlyMdTzVh0PfkrgMAAL3zNPabmh4t9B2Bf41UA 08jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=GsRBTV8V; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a170902e54f00b001518e798313si2846842plf.619.2022.03.02.00.46.58; Wed, 02 Mar 2022 00:47:16 -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=@ziepe.ca header.s=google header.b=GsRBTV8V; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235098AbiCAOG3 (ORCPT + 99 others); Tue, 1 Mar 2022 09:06:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234891AbiCAOG2 (ORCPT ); Tue, 1 Mar 2022 09:06:28 -0500 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7EAE52E36 for ; Tue, 1 Mar 2022 06:05:46 -0800 (PST) Received: by mail-qk1-x732.google.com with SMTP id n185so12960027qke.5 for ; Tue, 01 Mar 2022 06:05:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wtjizohg2CiwaFsaFvPT2wpJpMfkgawgg3Rxz5LmFXY=; b=GsRBTV8VD/o9MySrOhudutHADbuYL9ep+ZxLIVZMNyyhVObhTfhbQKDkqaWRomFsGq 1aMX+BXHg9wrjqRQtEQ/rdwOZ+r0PJZmslM7L2fWNkzcWorK3mxoYmkUenKeE/IQp2zT PfsBEkDUvDjHmmPoi+BdD1txx9RyeAeZOBmv+Co8oHJF1nRUNBPN/vcCSfdxgUlWJtMI RFrDwr0/c7+BC0eFSdtRqiGO/Ku6kYR9n3K6ARHTgS1/wBLRniW7lSlCjaoVNTKa2Pja YkYoAn4N5Xbq1YwIgQizbvOZ87EwU0eBxKhm2ByIgZBeX26qUESOJF0PtcEau2YRMQni k2sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wtjizohg2CiwaFsaFvPT2wpJpMfkgawgg3Rxz5LmFXY=; b=i7JboQHFOJXifUtZ3D0g2XWEwt9efZJkszZ422em/BmWd4ec2tnu/K69dh8hQ8rP3l FcLezi4Yr4Wigs+2/uywFCpl/mepeK1ZfybYD7nr3PW3HZsVmgd5HqBIVHC1nDI8A+XP rrxD8GQ5NU4igGqE5Ebojtfxk4yVVF57llhfGtESDPcRFXcebs4BImR6txCMf4CO8yS+ oU485zoPR+S4Ht1uFxUqRSzSBjwAjgO0PaD4dLBb4uIPWF6c/dLNjTVf4CM1R7i04fwG Mg447bVMOtFG3OIDjO+mBVs5ImPqO65M0WmRzI8WWOoBCFL3uJ+nkzQpcjdRn7nErtJt 7c5Q== X-Gm-Message-State: AOAM531OBQdhV4KZLmv8PVbhPSanC+W2Af4iRmik2DQNujjB53OAqHQy KNrYJda0MQ7g85B0Bu7mvQqiWROhvyaHgQ== X-Received: by 2002:a37:a246:0:b0:49b:679a:2f2b with SMTP id l67-20020a37a246000000b0049b679a2f2bmr13467991qke.702.1646143545990; Tue, 01 Mar 2022 06:05:45 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id d4-20020a05620a136400b0060dda40b3ecsm6536312qkl.30.2022.03.01.06.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Mar 2022 06:05:45 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1nP38K-003W39-LL; Tue, 01 Mar 2022 10:05:44 -0400 Date: Tue, 1 Mar 2022 10:05:44 -0400 From: Jason Gunthorpe To: Lino Sanfilippo 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 Subject: Re: [PATCH v8 1/1] tpm: fix reference counting for struct tpm_chip Message-ID: <20220301140544.GF6468@ziepe.ca> References: <20220301022108.30310-1-LinoSanfilippo@gmx.de> <20220301022108.30310-2-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220301022108.30310-2-LinoSanfilippo@gmx.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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. It looks like a good idea to me Jason