From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Leendert van Doorn <leendert@watson.ibm.com>,
Debora Velarde <debora@linux.vnet.ibm.com>,
Rajiv Andrade <srajiv@linux.vnet.ibm.com>,
Marcel Selhorst <m.selhorst@sirrix.com>,
tpmdd-devel@lists.sourceforge.net
Subject: [PATCH] tpm: tpm_nsc: Fix a double free of pdev in cleanup_nsc
Date: Thu, 04 Aug 2011 07:58:07 +0800 [thread overview]
Message-ID: <1312415887.2604.1.camel@phoenix> (raw)
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
next reply other threads:[~2011-08-03 23:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-03 23:58 Axel Lin [this message]
2011-08-05 14:20 ` [PATCH] tpm: tpm_nsc: Fix a double free of pdev in cleanup_nsc Stefan Berger
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=1312415887.2604.1.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=debora@linux.vnet.ibm.com \
--cc=leendert@watson.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.selhorst@sirrix.com \
--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 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.