]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tpm: st33zp24: Fix missing cleanup on get_burstcount() error
authorAlper Ak <alperyasinak1@gmail.com>
Fri, 26 Dec 2025 12:09:27 +0000 (15:09 +0300)
committerJarkko Sakkinen <jarkko@kernel.org>
Tue, 3 Feb 2026 00:36:32 +0000 (02:36 +0200)
get_burstcount() can return -EBUSY on timeout. When this happens,
st33zp24_send() returns directly without releasing the locality
acquired earlier.

Use goto out_err to ensure proper cleanup when get_burstcount() fails.

Fixes: bf38b8710892 ("tpm/tpm_i2c_stm_st33: Split tpm_i2c_tpm_st33 in 2 layers (core + phy)")
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/st33zp24/st33zp24.c

index 2ed7815e4899b74f998f0d62c97eb3ee2ef3e8ac..e2b7451ea7ccd3f99aac56d79ed8e798b0be1523 100644 (file)
@@ -328,8 +328,10 @@ static int st33zp24_send(struct tpm_chip *chip, unsigned char *buf,
 
        for (i = 0; i < len - 1;) {
                burstcnt = get_burstcount(chip);
-               if (burstcnt < 0)
-                       return burstcnt;
+               if (burstcnt < 0) {
+                       ret = burstcnt;
+                       goto out_err;
+               }
                size = min_t(int, len - i - 1, burstcnt);
                ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_DATA_FIFO,
                                         buf + i, size);