diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 84cdf9025737722fe4341974cf3bce90d268bc3f..349b6edc5794401ab9a4388707a93f9570aeaa7c 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -116,6 +116,10 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf, err = -EAGAIN; if (!bytes_read && (filp->f_flags & O_NONBLOCK)) goto out; + if (bytes_read < 0) { + err = bytes_read; + goto out; + } err = -EFAULT; while (bytes_read && size) {