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 4.14 3/5] tpm_tis: extra chip->ops check on error path in tpm_tis_core_init
Date: Wed, 8 Jul 2020 11:42:06 -0400 [thread overview]
Message-ID: <20200708154208.3200232-3-sashal@kernel.org> (raw)
In-Reply-To: <20200708154208.3200232-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 9b1116501f209..c028ffd953326 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -897,7 +897,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
next prev parent reply other threads:[~2020-07-08 15:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 15:42 [PATCH AUTOSEL 4.14 1/5] drm/exynos: fix ref count leak in mic_pre_enable Sasha Levin
2020-07-08 15:42 ` [PATCH AUTOSEL 4.14 2/5] arm64/alternatives: use subsections for replacement sequences Sasha Levin
2020-07-08 15:42 ` Sasha Levin [this message]
2020-07-08 15:42 ` [PATCH AUTOSEL 4.14 4/5] gfs2: read-only mounts should grab the sd_freeze_gl glock Sasha Levin
2020-07-08 15:42 ` [PATCH AUTOSEL 4.14 5/5] 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=20200708154208.3200232-3-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).