public inbox for linux-kernel@vger.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>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Christophe Ricard <christophe.ricard@gmail.com>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: st33zp24: Fix missing cleanup on get_burstcount() error
Date: Fri, 2 Jan 2026 19:29:03 +0200	[thread overview]
Message-ID: <aVgAX5C5ih1VsNAD@kernel.org> (raw)
In-Reply-To: <20251226120929.61630-1-alperyasinak1@gmail.com>

On Fri, Dec 26, 2025 at 03:09:27PM +0300, Alper Ak wrote:
> 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>
> ---
>  drivers/char/tpm/st33zp24/st33zp24.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/st33zp24/st33zp24.c b/drivers/char/tpm/st33zp24/st33zp24.c
> index 2ed7815e4899..e2b7451ea7cc 100644
> --- a/drivers/char/tpm/st33zp24/st33zp24.c
> +++ b/drivers/char/tpm/st33zp24/st33zp24.c
> @@ -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);
> -- 
> 2.43.0
> 

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

BR, Jarkko

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-26 12:09 [PATCH] tpm: st33zp24: Fix missing cleanup on get_burstcount() error Alper Ak
2026-01-02 17:29 ` 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=aVgAX5C5ih1VsNAD@kernel.org \
    --to=jarkko@kernel.org \
    --cc=alperyasinak1@gmail.com \
    --cc=christophe.ricard@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=sgarzare@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox