ipmi_watchdog: Fix read syscall not responding to signals during sleep

Read syscall cannot response to sigals when data_to_read remains at 0
and the while loop cannot break.  Check signal_pending in the loop.

Reported-by: Zhen Ni <zhen.ni@easystack.cn>
Message-Id: <20230517085412.367022-1-zhen.ni@easystack.cn>
Signed-off-by: Corey Minyard <minyard@acm.org>
This commit is contained in:
Corey Minyard 2023-05-17 16:54:12 +08:00
parent 4d6d4c7f54
commit 9930702cfe

View File

@ -802,7 +802,7 @@ static ssize_t ipmi_read(struct file *file,
init_waitqueue_entry(&wait, current);
add_wait_queue(&read_q, &wait);
while (!data_to_read) {
while (!data_to_read && !signal_pending(current)) {
set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&ipmi_read_lock);
schedule();