public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm: check the chip reference before using it
@ 2012-05-28 16:23 Andi Shyti
  2012-05-28 16:37 ` Andi Shyti
  0 siblings, 1 reply; 2+ messages in thread
From: Andi Shyti @ 2012-05-28 16:23 UTC (permalink / raw)
  To: debora, srajiv, m.selhorst
  Cc: tpmdd-devel, linux-kernel, peterhuewe, andi.shyti, 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..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


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

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

Hi,

On Mon, May 28, 2012 at 06:23:12PM +0200, Andi Shyti wrote:
>  void tpm_dev_release(struct device *dev)
>  {
> +	if (!chip)
> +		return;
> +
>  	struct tpm_chip *chip = dev_get_drvdata(dev);

sorry wrong patch file... this is not going to work...
I'll resend it

Andi

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

end of thread, other threads:[~2012-05-28 16:37 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:23 [PATCH] tpm: check the chip reference before using it Andi Shyti
2012-05-28 16:37 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox