Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700441

Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal

From Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal
Date 2017-08-01 00:30 +0200
Message-ID <u9rmi-3wp-29@gated-at.bofh.it> (permalink)
References (1 earlier) <u4Vbn-7Nz-75@gated-at.bofh.it> <u7gY1-xa-1@gated-at.bofh.it> <u7ADn-4Bn-13@gated-at.bofh.it> <u7AN3-4TN-1@gated-at.bofh.it> <u8meZ-1y7-3@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


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 <jgunthorpe@obsidianresearch.com>
> > > > > 
> > > > > 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 <stefanb@linux.vnet.ibm.com>
> > > > 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.

/Jarkko

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 40/57] tpm: Provide strong locking for device removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-19 13:20 +0200
  Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Ben Hutchings <ben.hutchings@codethink.co.uk> - 2017-07-26 01:00 +0200
    Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-26 22:00 +0200
      Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-07-26 22:10 +0200
        Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-29 00:50 +0200
          Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-01 00:30 +0200
            Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 22:10 +0200
              Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 23:50 +0200
                Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-06 14:50 +0200
                Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-08 23:10 +0200
                Re: [PATCH 4.4 40/57] tpm: Provide strong locking for device removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-08 23:20 +0200

csiph-web