Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2851305pxb; Fri, 12 Feb 2021 03:06:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoupQ8sCaH15M4hFnitg0dRaJ7RrybWPkxFyx41Zgwlwnq9rIeJzws5CiFj7u8foznn+/O X-Received: by 2002:a05:6402:310a:: with SMTP id dc10mr2814587edb.258.1613127994270; Fri, 12 Feb 2021 03:06:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613127994; cv=none; d=google.com; s=arc-20160816; b=bAYQZjwLd7LPRWlO1+FrFVmUHGJk2NZonQcLbj74xl8l4prDbCKHA3A9oLiBL/fmHK UyC7vdNC02cCcP+70WpwKIBuLdY6i7xyq0A1rf+5kOMiU/2D8RQGl10UIlGgzNJYzq1Y U/7Tb+fFEUkRNi1+aGd3YL8Jk8Bqo0Tx4NmfxpTxrrClKnaCwOOeQgxrE3hmMCmt937J sYTUN4kekkFayI9nq8lsSfIvRhz8MaERgo3aX5hzIH0AlXXyBEaN1nh6WMQAkgB9cv7u Q6CYEJQ/0igAxsMcbFJM77Pi5hi8p7mPfhWd7gNbslUPxpIuYywsIwDQfryWEsl9nW4L i1tw== 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=ECjFxKky2ar3aP2N3U4ifXVG4Xmyw+55LxsfmyHry8c=; b=xVKBXZ/jdwAPa3rBuWHyVqI/cHJdU5MTWRzh4glde93avaTYkVB0eGjP1DaNFNT4c3 0gtecgVRHM0E1E+HZbk5+wKIlZnqGflkn0CzXrb+TZ1dkKA0MDmitw5Z5yyYkVFgsaDF UVGpWsy517FVpSz2V1mkbp64bNJja9e0cA3qOyRxPt0ATX8GxdoDFTWp5onqAQwVBhRD 4NP1tS6083XQdzBOD58Cl7+KKipRf5eQ0igLReUx/wmnOJflX/m154zjw1xfXPlrzuGE 0VF1rNdX358KwLj9rSxNh6Y6M/0bICYCFFyzF/RJWOBPAkhhY/wHbYkJtfwPFe0fSY4W ILNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CHWBNivK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce27si6186958edb.213.2021.02.12.03.06.10; Fri, 12 Feb 2021 03:06:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CHWBNivK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbhBLLFZ (ORCPT + 99 others); Fri, 12 Feb 2021 06:05:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:58934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbhBLLCx (ORCPT ); Fri, 12 Feb 2021 06:02:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F001264E65; Fri, 12 Feb 2021 11:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613127732; bh=mqaVkrZNgite2xCHD2lroZ/46M4yAFMZdhRJGSoS5Yk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CHWBNivK2sx1WQGie+cHGlaEvkRQRXUuv4rQb9e0tXy6I+cdqRuOLWU91qj4yHtpy NdUhxSYBu5g+DxqBHtEvDLcdkddjzw0fsNHcxtGvuOYzyvBICHc4HBPKO5SVSiw/xK VlBWjx16BpYX8xQ6wOb2JlPkoIWa1VVycuOjgEz4+zQCfL6Pliv/9fljuVY1RV1Rgf BkkARNRm5bBQU6BTOQEdsamHzAmPRBRgcc8sCmz8CL9xBAPtwKJV1rkKr5ky7qHoU2 H3+nGg9r3im3BJV6bDhw3R3NIdGmCsfFLPihE2d5stYcBG4XPqWUlhGOD4a8vMZiTQ 5nEvPzuNKHaig== Date: Fri, 12 Feb 2021 13:02:03 +0200 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Lino Sanfilippo , James Bottomley , Lino Sanfilippo , peterhuewe@gmx.de, stefanb@linux.vnet.ibm.com, stable@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, seanjc@google.com Subject: Re: [PATCH v3 2/2] tpm: in tpm2_del_space check if ops pointer is still valid Message-ID: References: <1612482643-11796-1-git-send-email-LinoSanfilippo@gmx.de> <1612482643-11796-3-git-send-email-LinoSanfilippo@gmx.de> <7308e5e9f51501bd92cced8f28ff6130c976b3ed.camel@HansenPartnership.com> <20210205172528.GP4718@ziepe.ca> <08ce58ab-3513-5d98-16a5-b197276f6bce@kunbus.com> <20210209133653.GC4718@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210209133653.GC4718@ziepe.ca> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 09, 2021 at 09:36:53AM -0400, Jason Gunthorpe wrote: > On Tue, Feb 09, 2021 at 12:52:17PM +0100, Lino Sanfilippo wrote: > > > @@ -640,8 +643,10 @@ void tpm_chip_unregister(struct tpm_chip *chip) > > > if (IS_ENABLED(CONFIG_HW_RANDOM_TPM)) > > > hwrng_unregister(&chip->hwrng); > > > tpm_bios_log_teardown(chip); > > > - if (chip->flags & TPM_CHIP_FLAG_TPM2) > > > + if (chip->flags & TPM_CHIP_FLAG_TPM2) { > > > cdev_device_del(&chip->cdevs, &chip->devs); > > > + put_device(&chip->devs); > > > + } > > > tpm_del_char_device(chip); > > > } > > > EXPORT_SYMBOL_GPL(tpm_chip_unregister); > > > > > > > I tested the solution you scetched and it fixes the issue for me. Will you send a (real) patch for this? > > No, feel free to bundle this up with any fixes needed and send it with > a Signed-off-by from both of us > > I did it pretty fast so it will need a careful read that there isn't a > typo > > Thanks, > Jason Let's use CDB too as it exist and Sean kindly provided a better documentation for it in some recent kernel release. It's great exactly for this type of situation. /Jarkko