hwtracing: stm: fix possible double free in stm_register_device()
Subsystems (3)
PATCH 1/1 hwtracing: stm: fix possible double free in stm_register_device()
put_device() will call stm_device_release() to free stm when stm_register_device() fails. So there is no need to call vfree() again.
Fix this by adding a return after put_device().
--- drivers/hwtracing/stm/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwtracing/stm/core.c +1 -0
@@ -915,6 +915,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,/* matches device_initialize() above */ put_device (&stm->dev); +return err; err_free:vfree (stm);
Signature · 1 line
2.25.1
Ping
Quoted 23 lines · Hangyu Hua
put_device()will callstm_device_release()to free stm whenstm_register_device()fails. So there is no need to callvfree()again.Fix this by adding a return after
put_device().Fixes 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")Signed-off-by Hangyu Hua <[email protected]>--- drivers/hwtracing/stm/core.c | 1 + 1 file changed, 1 insertion(+)drivers/hwtracing/stm/core.c +1
-0@@ -915,6 +915,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,/* matches device_initialize() above */ put_device (&stm->dev); +return err; err_free:vfree (stm);
Gentel ping.
Quoted 25 lines · Hangyu Hua
Ping
Quoted 22 lines · Hangyu Hua
put_device()will callstm_device_release()to free stm whenstm_register_device()fails. So there is no need to callvfree()again.Fix this by adding a return after
put_device().Fixes 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")Signed-off-by Hangyu Hua <[email protected]>---
drivers/hwtracing/stm/core.c| 1 +1 file changed, 1 insertion(+)drivers/hwtracing/stm/core.c +1
-0@@ -915,6 +915,7 @@ int stm_register_device(struct device *parent,struct stm_data *stm_data, /* matches device_initialize() above */ put_device(&stm->dev); + return err;
err_free:
vfree(stm);
Quoted 17 lines · Hangyu Hua
Gentel ping.
Quoted 14 lines · Hangyu Hua
Ping
Quoted 11 lines · Hangyu Hua
put_device()will callstm_device_release()to free stm whenstm_register_device()fails. So there is no need to callvfree()again.Fix this by adding a return after
put_device().Fixes 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")Signed-off-by Hangyu Hua <[email protected]>---
drivers/hwtracing/stm/core.c| 1 +1 file changed, 1 insertion(+)
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/hwtracing/stm/core.c +1
-0@@ -915,6 +915,7 @@ int stm_register_device(struct device *parent,struct stm_data *stm_data, /* matches device_initialize() above */ put_device(&stm->dev); + return err;
err_free:
vfree(stm);
Gentel ping.