All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Alper Ak <alperyasinak1@gmail.com>
Cc: peterhuewe@gmx.de, Jason Gunthorpe <jgg@ziepe.ca>,
	Bryan Freed <bfreed@chromium.org>,
	Andi Shyti <andi.shyti@gmail.com>,
	Kent Yoder <key@linux.vnet.ibm.com>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: tpm_i2c_infineon: Fix locality leak on get_burstcount() failure
Date: Fri, 2 Jan 2026 19:17:24 +0200	[thread overview]
Message-ID: <aVf9pNiv4fKAKgl9@kernel.org> (raw)
In-Reply-To: <20251226102339.45054-1-alperyasinak1@gmail.com>

On Fri, Dec 26, 2025 at 01:23:38PM +0300, Alper Ak wrote:
> get_burstcount() can return -EBUSY on timeout. When this happens, the
> function returns directly without releasing the locality that was
> acquired at the beginning of tpm_tis_i2c_send().
> 
> Use goto out_err to ensure proper cleanup when get_burstcount() fails.
> 
> Fixes: aad628c1d91a ("char/tpm: Add new driver for Infineon I2C TIS TPM")
> Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
> ---
>  drivers/char/tpm/tpm_i2c_infineon.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
> index bdf1f329a679..8b7d32de0b2e 100644
> --- a/drivers/char/tpm/tpm_i2c_infineon.c
> +++ b/drivers/char/tpm/tpm_i2c_infineon.c
> @@ -544,8 +544,10 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
>  		burstcnt = get_burstcount(chip);
>  
>  		/* burstcnt < 0 = TPM is busy */
> -		if (burstcnt < 0)
> -			return burstcnt;
> +		if (burstcnt < 0) {
> +			rc = burstcnt;
> +			goto out_err;
> +		}
>  
>  		if (burstcnt > (len - 1 - count))
>  			burstcnt = len - 1 - count;
> -- 
> 2.43.0
> 

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

      reply	other threads:[~2026-01-02 17:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-26 10:23 [PATCH] tpm: tpm_i2c_infineon: Fix locality leak on get_burstcount() failure Alper Ak
2026-01-02 17:17 ` Jarkko Sakkinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aVf9pNiv4fKAKgl9@kernel.org \
    --to=jarkko@kernel.org \
    --cc=alperyasinak1@gmail.com \
    --cc=andi.shyti@gmail.com \
    --cc=bfreed@chromium.org \
    --cc=jgg@ziepe.ca \
    --cc=key@linux.vnet.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd@selhorst.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.