linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm: add check after commands attribs tab allocation
@ 2019-10-07 21:46 Tadeusz Struk
  2019-10-07 23:46 ` Jerry Snitselaar
  2019-10-08 23:27 ` Jarkko Sakkinen
  0 siblings, 2 replies; 3+ messages in thread
From: Tadeusz Struk @ 2019-10-07 21:46 UTC (permalink / raw)
  To: jarkko.sakkinen; +Cc: linux-integrity, linux-kernel, stable, tadeusz.struk

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@intel.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)


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

* Re: [PATCH] tpm: add check after commands attribs tab allocation
  2019-10-07 21:46 [PATCH] tpm: add check after commands attribs tab allocation Tadeusz Struk
@ 2019-10-07 23:46 ` Jerry Snitselaar
  2019-10-08 23:27 ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Jerry Snitselaar @ 2019-10-07 23:46 UTC (permalink / raw)
  To: Tadeusz Struk; +Cc: jarkko.sakkinen, linux-integrity, linux-kernel, stable

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@intel.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@redhat.com>


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

* Re: [PATCH] tpm: add check after commands attribs tab allocation
  2019-10-07 21:46 [PATCH] tpm: add check after commands attribs tab allocation Tadeusz Struk
  2019-10-07 23:46 ` Jerry Snitselaar
@ 2019-10-08 23:27 ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2019-10-08 23:27 UTC (permalink / raw)
  To: Tadeusz Struk; +Cc: linux-integrity, linux-kernel, stable

On Mon, Oct 07, 2019 at 02:46:37PM -0700, 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@intel.com>

Thank you.

Cc: stable@vger.kernel.org
Reviewed-by:  Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

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

end of thread, other threads:[~2019-10-08 23:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 21:46 [PATCH] tpm: add check after commands attribs tab allocation Tadeusz Struk
2019-10-07 23:46 ` Jerry Snitselaar
2019-10-08 23:27 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).