Thread (5 messages) 5 messages, 2 authors, 2015-12-04

Re: [PATCH] hw_random: core, sleep interruptible in read

From: Jiri Slaby <hidden>
Date: 2015-11-27 15:40:41
Also in: lkml

On 11/27/2015, 02:06 PM, Herbert Xu wrote:
On Thu, Nov 26, 2015 at 08:56:29PM +0100, Jiri Slaby wrote:
quoted
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index a064237ff362..f003df162e09 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -238,7 +238,10 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
 			goto out;
 		}
 
-		mutex_lock(&reading_mutex);
+		if (mutex_lock_interruptible(&reading_mutex)) {
+			err = -EINTR;
Shouldn't this be ERESTARTSYS?
Yes, it actually can, given the retval is returned only if no data were
read yet.

thanks,
-- 
js
suse labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help