mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ipmi_watchdog: Fix read syscall not responding to signals during sleep
@ 2023-05-17  9:25 Zhen Ni
  0 siblings, 0 replies; only message in thread
From: Zhen Ni @ 2023-05-17  9:25 UTC (permalink / raw)
  To: minyard; +Cc: linux-kernel, Zhen Ni

Read syscall cannot response to sigals when data_to_read remains at 0
and the while loop cannot break. Fix it.

Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
 drivers/char/ipmi/ipmi_watchdog.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 0d4a8dcacfd4..e7eb3e140444 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -807,13 +807,12 @@ static ssize_t ipmi_read(struct file *file,
 			spin_unlock_irq(&ipmi_read_lock);
 			schedule();
 			spin_lock_irq(&ipmi_read_lock);
+			if (signal_pending(current)) {
+				rv = -ERESTARTSYS;
+				break;
+			}
 		}
 		remove_wait_queue(&read_q, &wait);
-
-		if (signal_pending(current)) {
-			rv = -ERESTARTSYS;
-			goto out;
-		}
 	}
 	data_to_read = 0;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-17  9:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17  9:25 [PATCH] ipmi_watchdog: Fix read syscall not responding to signals during sleep Zhen Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®