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


Groups > linux.kernel > #1559553

Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

From Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown
Date 2017-01-16 10:40 +0100
Message-ID <t0bVE-6TE-7@gated-at.bofh.it> (permalink)
References <sZkeB-7yO-3@gated-at.bofh.it> <sZkxX-7Fv-5@gated-at.bofh.it> <sZkHD-7ID-1@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


On Fri, Jan 13, 2017 at 04:42:30PM -0800, Andrey Pronin wrote:
> On Fri, Jan 13, 2017 at 05:28:57PM -0700, Jason Gunthorpe wrote:
> > On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote:
> > > Resetting TPM while processing a command may lead to issues
> > > on the next boot. Ensure that we don't have any ongoing
> > > commands, and that no further commands can be sent to the chip
> > > by unregistering the device in the shutdown handler.
> > > tpm_chip_unregister() waits for the completion of an ongoing
> > > command, if any, and then clears out chip->ops and unregisters
> > > sysfs entities.
> > 
> > Unregistering in a shutdown handler seems very strange, it also waits
> > for userspace things, so I wonder if it could be problematic?
> > 
> > Maybe just use
> > 
> >    down_write(&chip->ops_sem);
> >    chip->ops = NULL;
> >    up_write(&chip->ops_sem);
> > 
> > In the shutdown handler?
> 
> down_write(&chip->ops_sem) would still wait for completing the initiated
> writes, since tpm_write() in tpm-dev.c calls tpm_try_get_ops().
> Also, tpm-sysfs.c calls chip->ops directly, so sysfs should be
> unregistered first.

Why don't you fix the tpm-sysfs issue but rather misusing
tpm_chip_unregister?

/Jarkko

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


Thread

[PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-14 01:20 +0100
  Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-14 01:40 +0100
    Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-14 01:50 +0100
      Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-16 10:40 +0100
        Re: [tpmdd-devel] [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing  commands on shutdown Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-25 20:00 +0100
      Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-16 17:20 +0100
        Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-17 19:00 +0100
          Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-17 20:30 +0100
            Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-17 21:20 +0100
              Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-17 22:30 +0100
                Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-18 00:10 +0100
                Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-18 01:30 +0100
                Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-23 21:10 +0100
                Re: [tpmdd-devel] [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing  commands on shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-23 21:20 +0100
                Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-23 21:50 +0100
                Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-23 23:20 +0100
                Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-24 00:00 +0100

csiph-web