Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

printk: avoid double lock acquire

Commit 4f2a8d3cf5e ("printk: Fix console_sem vs logbuf_lock unlock race")
introduced another silly bug where we would want to acquire an already
held lock. Avoid this.

Reported-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Peter Zijlstra and committed by
Linus Torvalds
09dc3cf9 c193c82f

+2 -1
+2 -1
kernel/printk.c
··· 1293 1293 raw_spin_lock(&logbuf_lock); 1294 1294 if (con_start != log_end) 1295 1295 retry = 1; 1296 + raw_spin_unlock_irqrestore(&logbuf_lock, flags); 1297 + 1296 1298 if (retry && console_trylock()) 1297 1299 goto again; 1298 1300 1299 - raw_spin_unlock_irqrestore(&logbuf_lock, flags); 1300 1301 if (wake_klogd) 1301 1302 wake_up_klogd(); 1302 1303 }