Skip to content

Commit de69113

Browse files
AxelLinxjamesmorris
authored andcommitted
TPM: tpm_nsc: Fix a double free of pdev in cleanup_nsc
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>
1 parent 5ce5ed3 commit de69113

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

‎drivers/char/tpm/tpm_nsc.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,6 @@ static void __exit cleanup_nsc(void)
396396
if (pdev) {
397397
tpm_nsc_remove(&pdev->dev);
398398
platform_device_unregister(pdev);
399-
kfree(pdev);
400-
pdev = NULL;
401399
}
402400

403401
platform_driver_unregister(&nsc_drv);

0 commit comments

Comments
 (0)