diff options
| author | Naveen Kumar Chaudhary <naveen.osdev@gmail.com> | 2026-06-11 23:08:17 +0530 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-07-31 10:32:24 +0200 |
| commit | 7577e00b9ab506202b9f1a33de3cc8cc6413a4db (patch) | |
| tree | 7e52cccca1eb2f7d7a140d269146f1bff88131b8 /tools/perf/scripts/python/flamegraph.py | |
| parent | 5e601ab3615c86be7c4068ce992f94654693a032 (diff) | |
locking/lockdep: Fix NULL pointer dereference in __lock_set_class()
register_lock_class() can return NULL when the lock class pool is
exhausted, graph_lock() fails, or key validation fails. However,
__lock_set_class() uses the return value directly in pointer arithmetic
without a NULL check:
class = register_lock_class(lock, subclass, 0);
hlock->class_idx = class - lock_classes;
If class is NULL, this computes a wild offset that corrupts
hlock->class_idx. The subsequent reacquire_held_locks() call will
invoke hlock_class() with this corrupted index, leading to a NULL or
out-of-bounds pointer dereference.
Add the missing NULL check, consistent with how __lock_acquire() already
handles this case at the same call site.
Fixes: 64aa348edc61 ("lockdep: lock_set_subclass - reset a held lock's subclass")
Signed-off-by: Naveen Kumar Chaudhary <naveen.osdev@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Waiman Long <longman@redhat.com>
Reviewed-by: Dmitry Ilvokhin <d@ilvokhin.com>
Link: https://patch.msgid.link/h2kfw43n4527x6mgi2lwpz2rieqnfzgictpv4wr5nyfjkc47co@2r5vz4uz44db
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
0 files changed, 0 insertions, 0 deletions
