On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > From: James Bottomley <james.bottom...@hansenpartnership.com> > > Currently the Resource Manager (RM) is not exposed to userspace. > Make > this exposure via a separate device, which can now be opened multiple > times because each read/write transaction goes separately via the RM. > > Concurrency is protected by the chip->tpm_mutex for each read/write > transaction separately. The TPM is cleared of all transient objects > by the time the mutex is dropped, so there should be no interference > between the kernel and userspace.
There's a bug in this code that will crash on first command. This is the incremental fix. It must have got lost when I did the split. James --- diff --git a/drivers/char/tpm/tpms-dev.c b/drivers/char/tpm/tpms-dev.c index f4cb7a3..3eb5955 100644 --- a/drivers/char/tpm/tpms-dev.c +++ b/drivers/char/tpm/tpms-dev.c @@ -20,6 +20,11 @@ static int tpms_open(struct inode *inode, struct file *file) priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv == NULL) return -ENOMEM; + priv->space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); + if (priv->space.context_buf == NULL) { + kfree(priv); + return -ENOMEM; + } tpm_common_open(file, chip, &priv->priv); ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ tpmdd-devel mailing list tpmdd-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tpmdd-devel