Re: [PATCH] kprobe_event_gen_test : Fix error handling and resource cleanup

From
Luis Chamberlain <mcgrof@kernel.org>
Date
2025-09-07 01:23:05
Also in
lkml
Reply to
Fidal Palamparambil, 2025-09-06
On Sat, Sep 06, 2025 at 05:15:59PM +0400, Fidal Palamparambil wrote:
From: Fidal palamparambil <redacted>

This commit addresses several issues in the kprobe event generation test module:

1. Fixed NULL pointer management in error paths where trace_event_file pointers
   were not properly set to NULL after errors, potentially causing double-free
   or use-after-free issues.

2. Added comprehensive cleanup for the kprobe event when kretprobe initialization
   fails in kprobe_event_gen_test_init(). Previously, a failed kretprobe creation
   would leave the kprobe event dangling.

3. Enhanced error handling consistency between kprobe and kretprobe test functions,
   ensuring both follow the same pattern for resource cleanup.

4. Fixed the error handling flow in test_gen_kprobe_cmd() and test_gen_kretprobe_cmd()
   to properly set trace_event_file pointers to NULL when errors occur after
   event creation but before successful completion.

The changes ensure proper resource management and prevent potential memory
corruption or leaks during module initialization and cleanup.

Signed-off-by: Fidal palamparambil <redacted>
Please just stop.

 Luis
Thread (3 messages) 3 messages, 3 authors, last reply 2025-09-07
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help