tpm: Introduce flag TPM_TRANSMIT_RAW
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Wed, 24 May 2017 21:39:39 +0000 (17:39 -0400)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tue, 13 Jun 2017 19:02:09 +0000 (22:02 +0300)
Introduce the flag TPM_TRANSMIT_RAW that allows us to transmit
a command without recursing into the requesting of locality.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm.h

index a965a9f0e5d2ea3d470f22fbd59c2e0f734f516c..8ef5e1723efb394f5265fb159f2bc9aaa982064a 100644 (file)
@@ -416,7 +416,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
        /* Store the decision as chip->locality will be changed. */
        need_locality = chip->locality == -1;
 
-       if (need_locality && chip->ops->request_locality)  {
+       if (!(flags & TPM_TRANSMIT_RAW) &&
+           need_locality && chip->ops->request_locality)  {
                rc = chip->ops->request_locality(chip, 0);
                if (rc < 0)
                        goto out_no_locality;
index af05c1403c6e4cd6e00d6518892a3137c11ae092..1df0521138d316816f89fceb9db143c917155ded 100644 (file)
@@ -506,6 +506,7 @@ extern struct idr dev_nums_idr;
 
 enum tpm_transmit_flags {
        TPM_TRANSMIT_UNLOCKED   = BIT(0),
+       TPM_TRANSMIT_RAW        = BIT(1),
 };
 
 ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,