Skip to contentSkip to conversation

lockdep fix

GIT PULL Ingo Molnar 1 participant 1 message Dec 6, 2017 Locking primitives

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest locking-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-for-linus

# HEAD: 5e351ad106997e06b2dc3da9c6b939b95f67fb88 locking/lockdep: Fix possible NULL deref

Fix a possible NULL dereference for the (rare) case when a task doesn't have ->xhlocks space allocated due to kmalloc() OOM-ing.

Thanks,

Ingo

------------------>
Peter Zijlstra (1):
locking/lockdep: Fix possible NULL deref

 kernel/locking/lockdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/locking/lockdep.c +2 -1
index 9776da8db180..670d8d7d8087 100644
@@ -4790,7 +4790,8 @@ void lockdep_invariant_state(bool force)
 	 * Verify the former, enforce the latter.
 	 */
 	WARN_ON_ONCE(!force && current->lockdep_depth);
-	invalidate_xhlock(&xhlock(current->xhlock_idx));
+	if (current->xhlocks)
+		invalidate_xhlock(&xhlock(current->xhlock_idx));
 }
 
 static int cross_lock(struct lockdep_map *lock)