diff mbox series

[7/8] usb_pcwd: WDIOC_SETTIMEOUT: prevent preemption

Message ID 20230427133350.31064-8-oneukum@suse.com
State New
Headers show
Series [1/8] pwcd_usb: fix error handling in probe | expand

Commit Message

Oliver Neukum April 27, 2023, 1:33 p.m. UTC
Delays between altering the watchdog
and giving the keepalive need to be controlled.
Do not allow preemption.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/watchdog/pcwd_usb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 50ba88019ed6..09cae7a6ad07 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -459,10 +459,14 @@  static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
 		if (get_user(new_heartbeat, p))
 			return -EFAULT;
 
-		if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
+		preempt_disable(); /* we are on a clock now */
+		if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat)) {
+			preempt_enable();
 			return -EINVAL;
+		}
 
 		usb_pcwd_keepalive(usb_pcwd_device);
+		preempt_enable();
 	}
 		fallthrough;