stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Vasily Averin <vvs@virtuozzo.com>,
	Jerry Snitselaar <jsnitsel@redhat.com>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-integrity@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 14/16] tpm_tis: extra chip->ops check on error path in tpm_tis_core_init
Date: Wed,  8 Jul 2020 11:41:33 -0400	[thread overview]
Message-ID: <20200708154135.3199907-14-sashal@kernel.org> (raw)
In-Reply-To: <20200708154135.3199907-1-sashal@kernel.org>

From: Vasily Averin <vvs@virtuozzo.com>

[ Upstream commit ccf6fb858e17a8f8a914a1c6444d277cfedfeae6 ]

Found by smatch:
drivers/char/tpm/tpm_tis_core.c:1088 tpm_tis_core_init() warn:
 variable dereferenced before check 'chip->ops' (see line 979)

'chip->ops' is assigned in the beginning of function
in tpmm_chip_alloc->tpm_chip_alloc
and is used before first possible goto to error path.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/char/tpm/tpm_tis_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index bdcf8f25cd0d0..63f6bed78d893 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -1006,7 +1006,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	return 0;
 out_err:
-	if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
+	if (chip->ops->clk_enable != NULL)
 		chip->ops->clk_enable(chip, false);
 
 	tpm_tis_remove(chip);
-- 
2.25.1


  parent reply	other threads:[~2020-07-08 15:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 15:41 [PATCH AUTOSEL 5.4 01/16] drm/msm: fix potential memleak in error branch Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 02/16] drm/msm/dpu: allow initialization of encoder locks during encoder init Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 03/16] ima: extend boot_aggregate with kernel measurements Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 04/16] drm/exynos: Properly propagate return value in drm_iommu_attach_device() Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 05/16] drm/exynos: fix ref count leak in mic_pre_enable Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 06/16] x86/fpu: Reset MXCSR to default in kernel_fpu_begin() Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 07/16] thermal/drivers: imx: Fix missing of_node_put() at probe time Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 08/16] blk-mq-debugfs: update blk_queue_flag_name[] accordingly for new flags Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 09/16] m68k: nommu: register start of the memory with memblock Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 10/16] m68k: mm: fix node memblock init Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 11/16] dt-bindings: mailbox: zynqmp_ipi: fix unit address Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 12/16] cifs: prevent truncation from long to int in wait_for_free_credits Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 13/16] arm64/alternatives: use subsections for replacement sequences Sasha Levin
2020-07-08 15:41 ` Sasha Levin [this message]
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 15/16] gfs2: read-only mounts should grab the sd_freeze_gl glock Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 16/16] i2c: eg20t: Load module automatically if ID matches Sasha Levin

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=20200708154135.3199907-14-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jsnitsel@redhat.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vvs@virtuozzo.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;
as well as URLs for NNTP newsgroup(s).