提交 5e351ad1 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

locking/lockdep: Fix possible NULL deref

We can't invalidate xhlocks when we've not yet allocated any.
Reported-by: NDmitry Vyukov <dvyukov@google.com>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Fixes: f52be570 ("locking/lockdep: Untangle xhlock history save/restore from task independence")
Signed-off-by: NIngo Molnar <mingo@kernel.org>
上级 328b4ed9
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册