When period interrupts are disabled, while loop in snd_pcm_update_hw_ptr0() results in the machine locking up if runtime->hw_ptr_buffer_jiffies is 0. Validate runtime->hw_ptr_buffer_jiffies value before while loop to avoid delta check.
when runtime->hw_ptr_buffer_jiffies is 0 then update of while condition hdelta > xrun_threshold will be always true because hdelta will not change. This will lead to infinite loop causing lock-up
This issue found during stability test, below log explains CPU lock-up on CPU1
[ 922.249028] sched: RT throttling activated for rt_rq ffffffc0f9970778 (cpu 1) [ 922.249028] potential CPU hogs: [ 922.249028] **FastCapture (11426) [ 922.249105] ------------[ cut here ]---------
To fix this lock-up issue, added new condition to check if runtime-> hw_ptr_buffer_jiffies is ZERO or negative.
Raghu Bankapur (1): ALSA: pcm: fix blocking while loop in snd_pcm_update_hw_ptr0()
sound/core/pcm_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)