diff options
| author | Miaoqian Lin <linmq006@gmail.com> | 2025-10-27 11:40:44 -0600 |
|---|---|---|
| committer | Paul Walmsley <pjw@kernel.org> | 2025-10-27 11:40:44 -0600 |
| commit | c42458fcf54b3d0bc2ac06667c98dceb43831889 (patch) | |
| tree | 15de099d8b867ad1689fbd6fd25deaa238fa4f9a /tools/perf/util/scripting-engines/trace-event-python.c | |
| parent | riscv: ptdump: use seq_puts() in pt_dump_seq_puts() macro (diff) | |
| download | linux-c42458fcf54b3d0bc2ac06667c98dceb43831889.tar.gz linux-c42458fcf54b3d0bc2ac06667c98dceb43831889.zip | |
riscv: Fix memory leak in module_frob_arch_sections()
The current code directly overwrites the scratch pointer with the
return value of kvrealloc(). If kvrealloc() fails and returns NULL,
the original buffer becomes unreachable, causing a memory leak.
Fix this by using a temporary variable to store kvrealloc()'s return
value and only update the scratch pointer on success.
Found via static anlaysis and this is similar to commit 42378a9ca553
("bpf, verifier: Fix memory leak in array reallocation for stack state")
Fixes: be17c0df6795 ("riscv: module: Optimize PLT/GOT entry counting")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20251026091912.39727-1-linmq006@gmail.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
0 files changed, 0 insertions, 0 deletions
