public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm_crb: Fix an error handling path in crb_acpi_add()
@ 2023-02-25 10:58 Christophe JAILLET
  2023-08-20  6:21 ` Christophe JAILLET
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2023-02-25 10:58 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, Matthew Garrett
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-integrity

Some error paths don't call acpi_put_table() before returning.
Branch to the correct place instead of doing some direct return.

Fixes: 4d2732882703 ("tpm_crb: Add support for CRB devices based on Pluton")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/char/tpm/tpm_crb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 99698ee1a744..f7068bd8b3d0 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -771,12 +771,13 @@ static int crb_acpi_add(struct acpi_device *device)
 				FW_BUG "TPM2 ACPI table has wrong size %u for start method type %d\n",
 				buf->header.length,
 				ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON);
-			return -EINVAL;
+			rc = -EINVAL;
+			goto out;
 		}
 		crb_pluton = ACPI_ADD_PTR(struct tpm2_crb_pluton, buf, sizeof(*buf));
 		rc = crb_map_pluton(dev, priv, buf, crb_pluton);
 		if (rc)
-			return rc;
+			goto out;
 	}
 
 	priv->sm = sm;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-22 11:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-25 10:58 [PATCH] tpm_crb: Fix an error handling path in crb_acpi_add() Christophe JAILLET
2023-08-20  6:21 ` Christophe JAILLET
2023-08-20  6:25   ` Matthew Garrett
2023-08-22 11:28   ` Jarkko Sakkinen
2023-08-22 11:31     ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox