[GIT PULL] lockdep fix

From: Ingo Molnar
Date: Wed Dec 06 2017 - 17:14:07 EST


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(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 9776da8db180..670d8d7d8087 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -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)