From: syzbot <syzbot+c52ab18308964d248092@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [crypto?] INFO: task hung in hwrng_fillfn
Date: Sat, 25 Nov 2023 20:05:46 -0800 [thread overview]
Message-ID: <000000000000d02d4b060b064cd3@google.com> (raw)
In-Reply-To: <0000000000003d77e6060af9f233@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [crypto?] INFO: task hung in hwrng_fillfn
Author: eadavis@qq.com
please test task hung in hwrng_fillfn
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 98b1cc82c4af
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 420f155d251f..883412bbf9f2 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -225,17 +225,18 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
goto out;
}
- if (mutex_lock_interruptible(&reading_mutex)) {
- err = -ERESTARTSYS;
- goto out_put;
- }
if (!data_avail) {
+ if (mutex_lock_interruptible(&reading_mutex)) {
+ err = -ERESTARTSYS;
+ goto out_put;
+ }
bytes_read = rng_get_data(rng, rng_buffer,
rng_buffer_size(),
!(filp->f_flags & O_NONBLOCK));
+ mutex_unlock(&reading_mutex);
if (bytes_read < 0) {
err = bytes_read;
- goto out_unlock_reading;
+ goto out_put;
}
data_avail = bytes_read;
}
@@ -243,7 +244,7 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
if (!data_avail) {
if (filp->f_flags & O_NONBLOCK) {
err = -EAGAIN;
- goto out_unlock_reading;
+ goto out_put;
}
} else {
len = data_avail;
@@ -255,14 +256,13 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
if (copy_to_user(buf + ret, rng_buffer + data_avail,
len)) {
err = -EFAULT;
- goto out_unlock_reading;
+ goto out_put;
}
size -= len;
ret += len;
}
- mutex_unlock(&reading_mutex);
put_rng(rng);
if (need_resched())
@@ -276,8 +276,6 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
out:
return ret ? : err;
-out_unlock_reading:
- mutex_unlock(&reading_mutex);
out_put:
put_rng(rng);
goto out;
@@ -501,7 +499,10 @@ static int hwrng_fillfn(void *unused)
rng = get_current_rng();
if (IS_ERR(rng) || !rng)
break;
- mutex_lock(&reading_mutex);
+ if (mutex_lock_interruptible(&reading_mutex)) {
+ put_rng(rng);
+ return = -ERESTARTSYS;
+ }
rc = rng_get_data(rng, rng_fillbuf,
rng_buffer_size(), 1);
if (current_quality != rng->quality)
next prev parent reply other threads:[~2023-11-26 4:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-25 13:21 [syzbot] [crypto?] INFO: task hung in hwrng_fillfn syzbot
2023-11-26 3:52 ` syzbot
2023-11-26 4:05 ` syzbot [this message]
2023-11-26 4:06 ` syzbot
2023-11-26 5:35 ` syzbot
2023-11-29 2:59 ` [syzbot] [wireless?] WARNING in rate_control_rate_init syzbot
[not found] <20231126015722.882-1-hdanton@sina.com>
2023-11-26 2:20 ` [syzbot] [crypto?] INFO: task hung in hwrng_fillfn syzbot
[not found] <tencent_F212DD467B099FAEFC2ECD4C9227CFC6C306@qq.com>
2023-11-26 3:58 ` syzbot
[not found] <tencent_47250CBA28BB4A33079E2C1B9A4B071BF408@qq.com>
2023-11-26 4:11 ` syzbot
[not found] <tencent_AEB0786A6F682DF96F6C94A4E8A2EDEACC0A@qq.com>
2023-11-26 4:37 ` syzbot
[not found] <tencent_0C6106DF136B0364296703BF044A977D1705@qq.com>
2023-11-26 6:08 ` syzbot
[not found] <tencent_DB6F26C7B37BA362296123A96443F7759705@qq.com>
2023-11-29 3:23 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=000000000000d02d4b060b064cd3@google.com \
--to=syzbot+c52ab18308964d248092@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox