The patch below does not apply to the 3.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From c4eadfafb91d5501095c55ffadaa1168743f39d3 Mon Sep 17 00:00:00 2001
From: Christophe Ricard <[email protected]>
Date: Tue, 13 Jan 2015 23:13:14 +0100
Subject: [PATCH] tpm/tpm_i2c_stm_st33: Add status check when reading data on
 the FIFO

Add a return value check when reading data from the FIFO register.

Cc: <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Signed-off-by: Christophe Ricard <[email protected]>
Reviewed-by: Peter Huewe <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>

diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c 
b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 48c4808d5a7a..4f70296f3a7f 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -441,7 +441,7 @@ again:
  */
 static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
 {
-       int size = 0, burstcnt, len;
+       int size = 0, burstcnt, len, ret;
        struct tpm_stm_dev *tpm_dev;
 
        tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
@@ -455,7 +455,10 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, 
size_t count)
                if (burstcnt < 0)
                        return burstcnt;
                len = min_t(int, burstcnt, count - size);
-               I2C_READ_DATA(tpm_dev, TPM_DATA_FIFO, buf + size, len);
+               ret = I2C_READ_DATA(tpm_dev, TPM_DATA_FIFO, buf + size, len);
+               if (ret < 0)
+                       return ret;
+
                size += len;
        }
        return size;

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to