From: Andi Shyti <andi.shyti@gmail.com>
To: debora@linux.vnet.ibm.com, srajiv@linux.vnet.ibm.com,
m.selhorst@sirrix.com
Cc: tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
peterhuewe@gmx.de, andi.shyti@gmail.com, oatilla@gmail.com
Subject: [PATCH] tpm: check the chip reference before using it
Date: Mon, 28 May 2012 18:23:12 +0200 [thread overview]
Message-ID: <172ab3cfdd755d047e6366cc56b942820e02ffee.1338221569.git.andi.shyti@gmail.com> (raw)
If a driver calls tpm_dev_vendor_release for a device already released
then the driver will oops.
Signed-off-by: Andi Shyti <andi.shyti@gmail.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/char/tpm/tpm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index ad7c732..66e4c12 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1322,6 +1322,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume);
void tpm_dev_vendor_release(struct tpm_chip *chip)
{
+ if (!chip)
+ return;
+
if (chip->vendor.release)
chip->vendor.release(chip->dev);
@@ -1337,6 +1340,9 @@ EXPORT_SYMBOL_GPL(tpm_dev_vendor_release);
*/
void tpm_dev_release(struct device *dev)
{
+ if (!chip)
+ return;
+
struct tpm_chip *chip = dev_get_drvdata(dev);
tpm_dev_vendor_release(chip);
--
1.7.10
next reply other threads:[~2012-05-28 16:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-28 16:23 Andi Shyti [this message]
2012-05-28 16:37 ` Andi Shyti
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=172ab3cfdd755d047e6366cc56b942820e02ffee.1338221569.git.andi.shyti@gmail.com \
--to=andi.shyti@gmail.com \
--cc=debora@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.selhorst@sirrix.com \
--cc=oatilla@gmail.com \
--cc=peterhuewe@gmx.de \
--cc=srajiv@linux.vnet.ibm.com \
--cc=tpmdd-devel@lists.sourceforge.net \
/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
all inboxes | Powered by JetHome®