From: Theodore Ts'o <tytso@mit.edu>
To: penguin-kernel@I-love.SAKURA.ne.jp
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] random: fix possible sleeping allocation from irq context
Date: Mon, 23 Apr 2018 23:41:38 -0400 [thread overview]
Message-ID: <20180424034138.23994-1-tytso@mit.edu> (raw)
We can do a sleeping allocation from an irq context when CONFIG_NUMA
is enabled. Fix this by initializing the NUMA crng instances in a
workqueue.
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot+9de458f6a5e713ee8c1a@syzkaller.appspotmail.com
Fixes: 8ef35c866f8862df ("random: set up the NUMA crng instances...")
Cc: stable@vger.kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
drivers/char/random.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 3cd3aae24d6d..e182cca7e6cd 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -789,7 +789,7 @@ static void crng_initialize(struct crng_state *crng)
}
#ifdef CONFIG_NUMA
-static void numa_crng_init(void)
+static void do_numa_crng_init(struct work_struct *work)
{
int i;
struct crng_state *crng;
@@ -810,6 +810,13 @@ static void numa_crng_init(void)
kfree(pool);
}
}
+
+DECLARE_WORK(numa_crng_init_work, do_numa_crng_init);
+
+static void numa_crng_init(void)
+{
+ schedule_work(&numa_crng_init_work);
+}
#else
static void numa_crng_init(void) {}
#endif
--
2.16.1.72.g5be1f00a9a
next reply other threads:[~2018-04-24 3:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 3:41 Theodore Ts'o [this message]
2018-04-25 0:46 ` [PATCH] random: fix possible sleeping allocation from irq context Tetsuo Handa
2018-04-25 6:00 ` Theodore Y. Ts'o
2018-04-25 10:47 ` Tetsuo Handa
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=20180424034138.23994-1-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.