On Wed, May 17, 2023 at 04:54:12PM +0800, Zhen Ni wrote: > 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...@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; > + }
This is a bug, but your fix isn't quite correct. If you do this, then data_to_read will be set to zero on a signal, and you want to return the ERESTARTSYS and not clear data_to_read in that case. Instead of your fix, I have added a "!signal_pending()" to the while loop check, which was probably my original intent. -corey > } > remove_wait_queue(&read_q, &wait); > - > - if (signal_pending(current)) { > - rv = -ERESTARTSYS; > - goto out; > - } > } > data_to_read = 0; > > -- > 2.20.1 > _______________________________________________ Openipmi-developer mailing list Openipmi-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openipmi-developer