All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tpm: check the chip reference before using it
@ 2012-05-28 16:42 Andi Shyti
  2012-06-12 21:21 ` Rajiv Andrade
  0 siblings, 1 reply; 2+ messages in thread
From: Andi Shyti @ 2012-05-28 16:42 UTC (permalink / raw)
  To: debora, srajiv; +Cc: tpmdd-devel, linux-kernel, peterhuewe, oatilla

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..f5cabf5 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);
 
@@ -1339,6 +1342,9 @@ void tpm_dev_release(struct device *dev)
 {
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 
+	if (!chip)
+		return;
+
 	tpm_dev_vendor_release(chip);
 
 	chip->release(dev);
-- 
1.7.10


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

* Re: [PATCH v2] tpm: check the chip reference before using it
  2012-05-28 16:42 [PATCH v2] tpm: check the chip reference before using it Andi Shyti
@ 2012-06-12 21:21 ` Rajiv Andrade
  0 siblings, 0 replies; 2+ messages in thread
From: Rajiv Andrade @ 2012-06-12 21:21 UTC (permalink / raw)
  To: Andi Shyti; +Cc: debora, tpmdd-devel, linux-kernel, peterhuewe, oatilla, key

On Mon, 28 May 2012, Andi Shyti wrote:

> 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>

Thanks Andi, putting in a git pull request.

Rajiv





































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

end of thread, other threads:[~2012-06-12 21:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-28 16:42 [PATCH v2] tpm: check the chip reference before using it Andi Shyti
2012-06-12 21:21 ` Rajiv Andrade

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.