[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <575bc4a16cd2250b4f195bb90791425e102f6249.1426581621.git.jslaby@suse.cz>
Date: Tue, 17 Mar 2015 09:40:09 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Christophe Ricard <christophe.ricard@...il.com>,
Christophe Ricard <christophe-h.ricard@...com>,
Peter Huewe <peterhuewe@....de>, Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 031/175] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send
From: Christophe Ricard <christophe.ricard@...il.com>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1ba3b0b6f218072afe8372d12f1b6bf26a26008e upstream.
When sending data in tpm_stm_i2c_send, each loop iteration send buf.
Send buf + i instead as the goal of this for loop is to send a number
of byte from buf that fit in burstcnt. Once those byte are sent, we are
supposed to send the next ones.
The driver was working because the burstcount value returns always the maximum size for a TPM
command or response. (0x800 for a command and 0x400 for a response).
Reviewed-by: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@...com>
Signed-off-by: Peter Huewe <peterhuewe@....de>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
drivers/char/tpm/tpm_i2c_stm_st33.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 06af39ca901e..3f9edcd33f65 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -488,7 +488,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
if (burstcnt < 0)
return burstcnt;
size = min_t(int, len - i - 1, burstcnt);
- ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size);
+ ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf + i, size);
if (ret < 0)
goto out_err;
--
2.3.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists