diff options
author | Huang Ying <[email protected]> | 2024-09-30 15:06:11 +0800 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2024-10-09 12:47:19 -0700 |
commit | 0665d7a39bdf92c8ac3dc390501f303907c87f62 (patch) | |
tree | 760b1297c514385b937c2367fb8a1e2532ffdbf6 /tools/perf/scripts/python/syscall-counts-by-pid.py | |
parent | 3d5854d75e3187147613130561b58f0b06166172 (diff) |
resource, kunit: fix user-after-free in resource_test_region_intersects()
In resource_test_insert_resource(), the pointer is used in error message
after kfree(). This is user-after-free. To fix this, we need to call
kunit_add_action_or_reset() to schedule memory freeing after usage. But
kunit_add_action_or_reset() itself may fail and free the memory. So, its
return value should be checked and abort the test for failure. Then, we
found that other usage of kunit_add_action_or_reset() in
resource_test_region_intersects() needs to be fixed too. We fix all these
user-after-free bugs in this patch.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 99185c10d5d9 ("resource, kunit: add test case for region_intersects()")
Signed-off-by: "Huang, Ying" <[email protected]>
Reported-by: Kees Bakker <[email protected]>
Closes: https://lore.kernel.org/lkml/[email protected]/
Cc: Dan Williams <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts-by-pid.py')
0 files changed, 0 insertions, 0 deletions