patch-2.2.0-pre3 linux/drivers/char/random.c

Next file: linux/drivers/net/3c501.c
Previous file: linux/drivers/char/pms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre2/linux/drivers/char/random.c linux/drivers/char/random.c
@@ -232,6 +232,11 @@
  * Eastlake, Steve Crocker, and Jeff Schiller.
  */
 
+/*
+ * Added a check for signal pending in the extract_entropy() loop to allow
+ * the read(2) syscall to be interrupted. Copyright (C) 1998  Andrea Arcangeli
+ */
+
 #include <linux/utsname.h>
 #include <linux/config.h>
 #include <linux/kernel.h>
@@ -1269,7 +1274,14 @@
 		buf += i;
 		add_timer_randomness(r, &extract_timer_state, nbytes);
 		if (to_user && current->need_resched)
+		{
+			if (signal_pending(current))
+			{
+				ret = -EINTR;
+				break;
+			}
 			schedule();
+		}
 	}
 
 	/* Wipe data just returned from memory */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov