locking/lockdep: Fix NULL pointer dereference in __lock_set_class()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 64aa348edc617dea17bbd01ddee4e47886d5ec8c · < e7c69c6695d84220847cca62a45e879e71e79e9d| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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.
From the CVE record · Linux
The Linux kernel’s lockdep code fails to check whether lock-class registration returned NULL. If registration fails because the class pool is exhausted, graph_lock() fails, or key validation fails, the resulting invalid index can lead to a NULL or out-of-bounds pointer dereference. The input does not specify attacker access requirements or user interaction.
Engineers running the Linux kernel should check their versions; affected versions are not specified.