[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191007234627.fna7s5nvhgpv3bmq@cantor>
Date: Mon, 7 Oct 2019 16:46:27 -0700
From: Jerry Snitselaar <jsnitsel@...hat.com>
To: Tadeusz Struk <tadeusz.struk@...el.com>
Cc: jarkko.sakkinen@...ux.intel.com, linux-integrity@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] tpm: add check after commands attribs tab allocation
On Mon Oct 07 19, Tadeusz Struk wrote:
>devm_kcalloc() can fail and return NULL so we need to check for that.
>
>Fixes: 58472f5cd4f6f ("tpm: validate TPM 2.0 commands")
>Signed-off-by: Tadeusz Struk <tadeusz.struk@...el.com>
>---
> drivers/char/tpm/tpm2-cmd.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
>index ba9acae83bff..5817dfe5c5d2 100644
>--- a/drivers/char/tpm/tpm2-cmd.c
>+++ b/drivers/char/tpm/tpm2-cmd.c
>@@ -939,6 +939,10 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
>
> chip->cc_attrs_tbl = devm_kcalloc(&chip->dev, 4, nr_commands,
> GFP_KERNEL);
>+ if (!chip->cc_attrs_tbl) {
>+ rc = -ENOMEM;
>+ goto out;
>+ }
>
> rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_CAPABILITY);
> if (rc)
>
Reviewed-by: Jerry Snitselaar <jsnitsel@...hat.com>
Powered by blists - more mailing lists