public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm: tpm_nsc: Fix a double free of pdev in cleanup_nsc
@ 2011-08-03 23:58 Axel Lin
  2011-08-05 14:20 ` Stefan Berger
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-08-03 23:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Leendert van Doorn, Debora Velarde, Rajiv Andrade,
	Marcel Selhorst, tpmdd-devel

platform_device_unregister() will release all resources
and remove it from the subsystem, then drop reference count by
calling platform_device_put().

We should not call kfree(pdev) after platform_device_unregister(pdev).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/char/tpm/tpm_nsc.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
index 82facc9..4d24648 100644
--- a/drivers/char/tpm/tpm_nsc.c
+++ b/drivers/char/tpm/tpm_nsc.c
@@ -396,8 +396,6 @@ static void __exit cleanup_nsc(void)
 	if (pdev) {
 		tpm_nsc_remove(&pdev->dev);
 		platform_device_unregister(pdev);
-		kfree(pdev);
-		pdev = NULL;
 	}
 
 	platform_driver_unregister(&nsc_drv);
-- 
1.7.4.1




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

end of thread, other threads:[~2011-08-05 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-03 23:58 [PATCH] tpm: tpm_nsc: Fix a double free of pdev in cleanup_nsc Axel Lin
2011-08-05 14:20 ` Stefan Berger

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