mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
tpm: tpm_nsc: stop using the cleanup callback as dev.release
tpm_nsc_remove() is called explicitly from cleanup_nsc() and also
runs as the platform device release callback on the final
platform_device_put(), so the cleanup executes twice on module
exit; the second invocation operates on a chip that has already
been freed by the devm cleanup, and the I/O region is released
twice.
Overwriting the release callback installed by
platform_device_alloc() also keeps platform_device_release() from
running, leaking the platform object allocation.
Leave the default release callback in place; the explicit call in
cleanup_nsc() remains the single cleanup point.
Cc: stable@vger.kernel.org
Fixes: 570302a311 ("[PATCH] tpm: move nsc driver off pci_dev")
Assisted-by: GLM-5.3
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/a6155310e6772f708b47291cc959e02c05b90eb7.1791015549.git.xiaopei01@kylinos.cn
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
This commit is contained in:
parent
1900449684
commit
df0ef27108
|
|
@ -327,7 +327,6 @@ static int __init init_nsc(void)
|
|||
|
||||
pdev->num_resources = 0;
|
||||
pdev->dev.driver = &nsc_drv.driver;
|
||||
pdev->dev.release = tpm_nsc_remove;
|
||||
|
||||
if ((rc = platform_device_add(pdev)) < 0)
|
||||
goto err_put_dev;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user