lkml.org 
[lkml]   [2015]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.19 097/175] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send
    Date
    3.19-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Christophe Ricard <christophe.ricard@gmail.com>

    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@obsidianresearch.com>
    Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
    Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/char/tpm/tpm_i2c_stm_st33.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/char/tpm/tpm_i2c_stm_st33.c
    +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
    @@ -487,7 +487,7 @@ static int tpm_stm_i2c_send(struct tpm_c
    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;




    \
     
     \ /
      Last update: 2015-03-04 08:21    [W:2.103 / U:0.208 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site