Skip to content

Commit 1fa1b6c

Browse files
Wei Yongjungregkh
authored andcommitted
intel_th: msu: Fix possible memory leak in mode_store()
'mode' is malloced in mode_store() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: 615c164 ("intel_th: msu: Introduce buffer interface") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8e3ef7b commit 1fa1b6c

File tree

1 file changed

+3
-1
lines changed
  • drivers/hwtracing/intel_th

1 file changed

+3
-1
lines changed

drivers/hwtracing/intel_th/msu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,8 +1852,10 @@ mode_store(struct device *dev, struct device_attribute *attr, const char *buf,
18521852
return -ENOMEM;
18531853

18541854
i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);
1855-
if (i >= 0)
1855+
if (i >= 0) {
1856+
kfree(mode);
18561857
goto found;
1858+
}
18571859

18581860
/* Buffer sinks only work with a usable IRQ */
18591861
if (!msc->do_irq) {

0 commit comments

Comments
 (0)