From: Konrad Rzeszutek Wilk Date: Fri, 9 Jun 2017 13:31:28 +0000 (-0400) Subject: livepatch: Wrong usage of spinlock on debug console. X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2054 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=75dfe7c566c36e0af4714557a666827f49b69191;p=xen.git livepatch: Wrong usage of spinlock on debug console. If we have a large amount of livepatches and want to print them on the console using 'xl debug-keys x' we eventually hit the preemption check: if ( i && !(i % 64) ) { spin_unlock(&payload_lock); process_pending_softirqs(); if ( spin_trylock(&payload_lock) ) return The effect is that we have just effectively taken the lock and returned without unlocking! Reviewed-by: Ross Lagerwall Reviewed-and-tested-by: Boris Ostrovsky Reviewed-by: Jan Beulich CC: Andrew Cooper Release-acked-by: Julien Grall Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index f14bcbc8cd..df67a1aa2c 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -1642,7 +1642,7 @@ static void livepatch_printall(unsigned char key) { spin_unlock(&payload_lock); process_pending_softirqs(); - if ( spin_trylock(&payload_lock) ) + if ( !spin_trylock(&payload_lock) ) { printk("Couldn't reacquire lock. Try again.\n"); return;