Skip to content

Commit

Permalink
TPM: tpm_nsc: Fix a double free of pdev in cleanup_nsc
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
Axel Lin authored and James Morris committed Sep 22, 2011
1 parent 5ce5ed3 commit de69113
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/char/tpm/tpm_nsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit de69113

Please sign in to comment.