mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhen Ni <zhen.ni@easystack.cn>
To: minyard@acm.org
Cc: linux-kernel@vger.kernel.org, Zhen Ni <zhen.ni@easystack.cn>
Subject: [PATCH] ipmi_watchdog: Fix read syscall not responding to signals during sleep
Date: Wed, 17 May 2023 17:25:08 +0800	[thread overview]
Message-ID: <20230517092508.369197-1-zhen.ni@easystack.cn> (raw)

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


                 reply	other threads:[~2023-05-17  9:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230517092508.369197-1-zhen.ni@easystack.cn \
    --to=zhen.ni@easystack.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®