Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751398AbdHFMr4 (ORCPT ); Sun, 6 Aug 2017 08:47:56 -0400 Received: from mga01.intel.com ([192.55.52.88]:62705 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751277AbdHFMry (ORCPT ); Sun, 6 Aug 2017 08:47:54 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,332,1498546800"; d="scan'208";a="1159731626" Date: Sun, 6 Aug 2017 15:47:49 +0300 From: Jarkko Sakkinen To: Greg Kroah-Hartman Cc: Jason Gunthorpe , Ben Hutchings , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Stefan Berger Subject: Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Message-ID: <20170806124749.kygplept7mgxblpo@linux.intel.com> References: <20170719111249.973558472@linuxfoundation.org> <20170719111251.592825675@linuxfoundation.org> <1501023361.12197.191.camel@codethink.co.uk> <20170726195636.GD30597@kroah.com> <20170726200306.GB2692@obsidianresearch.com> <20170728224218.GC22460@kroah.com> <20170731222254.clmziqtjybv3hmtm@linux.intel.com> <20170804195956.GG3477@kroah.com> <20170804214418.GA23877@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170804214418.GA23877@kroah.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3280 Lines: 76 On Fri, Aug 04, 2017 at 02:44:18PM -0700, Greg Kroah-Hartman wrote: > On Fri, Aug 04, 2017 at 12:59:56PM -0700, Greg Kroah-Hartman wrote: > > On Tue, Aug 01, 2017 at 01:22:54AM +0300, Jarkko Sakkinen wrote: > > > On Fri, Jul 28, 2017 at 03:42:18PM -0700, Greg Kroah-Hartman wrote: > > > > On Wed, Jul 26, 2017 at 02:03:06PM -0600, Jason Gunthorpe wrote: > > > > > On Wed, Jul 26, 2017 at 12:56:37PM -0700, Greg Kroah-Hartman wrote: > > > > > > On Tue, Jul 25, 2017 at 11:56:01PM +0100, Ben Hutchings wrote: > > > > > > > On Wed, 2017-07-19 at 13:12 +0200, Greg Kroah-Hartman wrote: > > > > > > > > 4.4-stable review patch. If anyone has any objections, please let me know. > > > > > > > > > > > > > > > > > > > > > > > > From: Jason Gunthorpe > > > > > > > > > > > > > > > > commit 4e26195f240d73150e8308ae42874702e3df8d2c upstream. > > > > > > > > > > > > > > > > Add a read/write semaphore around the ops function pointers so > > > > > > > > ops can be set to null when the driver un-registers. > > > > > > > [...] > > > > > > > > @@ -49,10 +99,10 @@ struct tpm_chip *tpm_chip_find_get(int c > > > > > > > > if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num) > > > > > > > > continue; > > > > > > > > > > > > > > > > - if (try_module_get(pos->dev.parent->driver->owner)) { > > > > > > > > + /* rcu prevents chip from being free'd */ > > > > > > > > + if (!tpm_try_get_ops(pos)) > > > > > > > [...] > > > > > > > > > > > > > > But an RCU read-side critical section is an atomic context, and > > > > > > > semaphore operations can block! Fixed upstream by: > > > > > > > > > > > > > > commit 15516788e581eb32ec1c50e5f00aba3faf95d817 > > > > > > > Author: Stefan Berger > > > > > > > Date: Mon Feb 29 08:53:02 2016 -0500 > > > > > > > > > > > > > > tpm: Replace device number bitmap with IDR > > > > > > > > > > > > Ugh, that's a big patch. > > > > > > > > > > > > Jason, Stefan, and Jarkko, what do you think? Should I also take this > > > > > > for 4.4-stable? > > > > > > > > > > 15516 is part of the series that included 4e26, I wouldn't take that > > > > > series piecemeal, as Ben observes.. > > > > > > > > > > I think it would be safer to avoid all these backport patches and > > > > > instead restructure the important TPM shutdown patch so that it is > > > > > 'less safe'. This would mean there is a chance that the another TPM > > > > > user could send a command after shutdown, but realistically that is > > > > > not likely to happen. > > > > > > > > Ok, so what do you want me to do here? > > > > > > > > thanks, > > > > > > > > greg k-h > > > > > > Sorry for late response. I just came from four week leave (have been > > > watching kernel mails only 1-2 times a week and missed this thread). > > > > > > I would actually think that taking this patch would make sense as the > > > changes are trivial and also because this code has reminded almost > > > unchanged after it was added. > > > > Ok, now queued up, thanks. > > But it's messy, if someone could verify that this is all working > properly on the 4.4-stable kernel with the next -rc release, I would > really appreciate it. > > thanks, > > greg k-h I will take care of that. Thank you. /Jarkko