mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwtracing: stm: fix possible double free in stm_register_device()
@ 2022-04-18  8:16 Hangyu Hua
  2022-05-05  1:29 ` Hangyu Hua
  0 siblings, 1 reply; 4+ messages in thread
From: Hangyu Hua @ 2022-04-18  8:16 UTC (permalink / raw)
  To: alexander.shishkin, mcoquelin.stm32, alexandre.torgue, gregkh,
	mathieu.poirier
  Cc: linux-stm32, linux-arm-kernel, linux-kernel, Hangyu Hua

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().

Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 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 2712e699ba08..403b4f41bb1b 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);
+	return err;
 err_free:
 	vfree(stm);
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-23  1:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18  8:16 [PATCH] hwtracing: stm: fix possible double free in stm_register_device() Hangyu Hua
2022-05-05  1:29 ` Hangyu Hua
2022-05-23  1:55   ` Hangyu Hua
2022-06-23  1:44     ` Hangyu Hua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®