diff options
| author | Huang Ying <[email protected]> | 2024-09-30 07:06:11 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-10-09 19:47:19 +0000 |
| commit | 0665d7a39bdf92c8ac3dc390501f303907c87f62 (patch) | |
| tree | 760b1297c514385b937c2367fb8a1e2532ffdbf6 /rust/helpers/signal.c | |
| parent | fs/proc/kcore.c: allow translation of physical memory addresses (diff) | |
| download | kernel-0665d7a39bdf92c8ac3dc390501f303907c87f62.tar.gz kernel-0665d7a39bdf92c8ac3dc390501f303907c87f62.zip | |
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 'rust/helpers/signal.c')
0 files changed, 0 insertions, 0 deletions
