[PATCH] stm class: Fix a potential double free in stm_register_device
Dinghao Liu
dinghao.liu at zju.edu.cn
Wed Sep 20 22:03:52 PDT 2023
In the error handling path after err_device, the vfree is
redundant. stm_device_release will free the stm device
after put_device(). Set stm to NULL to prevent double free.
Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")
Signed-off-by: Dinghao Liu <dinghao.liu at zju.edu.cn>
---
drivers/hwtracing/stm/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 534fbefc7f6a..5500aa5046ee 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -915,6 +915,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
/* matches device_initialize() above */
put_device(&stm->dev);
+ stm = NULL;
err_free:
vfree(stm);
--
2.17.1
More information about the linux-arm-kernel
mailing list