From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751123AbcBMKIY (ORCPT ); Sat, 13 Feb 2016 05:08:24 -0500 Received: from mga01.intel.com ([192.55.52.88]:52964 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbcBMKIW (ORCPT ); Sat, 13 Feb 2016 05:08:22 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,439,1449561600"; d="scan'208";a="914411904" Date: Sat, 13 Feb 2016 12:08:18 +0200 From: Jarkko Sakkinen To: Jason Gunthorpe , jmorris@namei.org Cc: tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Stefan Berger , Peter Huewe Subject: Re: [PATCH 1/3] tpm: Hold the kref during tpm_chip_find_get Message-ID: <20160213100818.GA12607@intel.com> References: <1455321871-28296-1-git-send-email-jgunthorpe@obsidianresearch.com> <1455321871-28296-2-git-send-email-jgunthorpe@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455321871-28296-2-git-send-email-jgunthorpe@obsidianresearch.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 12, 2016 at 05:04:29PM -0700, Jason Gunthorpe wrote: > This was missed during the struct device conversion, we > need to hold a kref on the chip to make sure it isn't freed. > > Signed-off-by: Jason Gunthorpe Reviewed-by: Jarkko Sakkinen For rest of the patches I'll look at them post-v4.5. I'm still waiting for my first pull request containing fixes for that release to be taken. James, would it be possible to take the pull request containing fixes soon that I origianally sent already in Jan and bit updated version few days ago [1]? I still have one more pull request coming after that. It will contain only few line changes: * Missing put_device() in two places. * There is a small change to ABI behavior (I'll post it soon) of policy sealing so I really need it for this release because 4.5 is the first release containing this feature and I cannot change it when the release is tagged. Thank you. [1] http://www.gossamer-threads.com/lists/linux/kernel/2366902 /Jarkko > --- > drivers/char/tpm/tpm-chip.c | 2 ++ > drivers/char/tpm/tpm.h | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > index 45cc39aabeee..ae2fed8a162b 100644 > --- a/drivers/char/tpm/tpm-chip.c > +++ b/drivers/char/tpm/tpm-chip.c > @@ -53,6 +53,8 @@ struct tpm_chip *tpm_chip_find_get(int chip_num) > chip = pos; > break; > } > + > + get_device(&chip->dev); > } > rcu_read_unlock(); > return chip; > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index 542a80cbfd9c..f6ba79d91857 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -207,6 +207,7 @@ struct tpm_chip { > static inline void tpm_chip_put(struct tpm_chip *chip) > { > module_put(chip->pdev->driver->owner); > + put_device(&chip->dev); > } > > static inline int tpm_read_index(int base, int index) > -- > 2.1.4 >