Commit ffc5b50a authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Greg Kroah-Hartman

random: fix possible sleeping allocation from irq context

commit 6c1e851c upstream.

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: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot+9de458f6a5e713ee8c1a@syzkaller.appspotmail.com
Fixes: 8ef35c86 ("random: set up the NUMA crng instances...")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 812b51a6
...@@ -788,7 +788,7 @@ static void crng_initialize(struct crng_state *crng) ...@@ -788,7 +788,7 @@ static void crng_initialize(struct crng_state *crng)
} }
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
static void numa_crng_init(void) static void do_numa_crng_init(struct work_struct *work)
{ {
int i; int i;
struct crng_state *crng; struct crng_state *crng;
...@@ -809,6 +809,13 @@ static void numa_crng_init(void) ...@@ -809,6 +809,13 @@ static void numa_crng_init(void)
kfree(pool); kfree(pool);
} }
} }
static DECLARE_WORK(numa_crng_init_work, do_numa_crng_init);
static void numa_crng_init(void)
{
schedule_work(&numa_crng_init_work);
}
#else #else
static void numa_crng_init(void) {} static void numa_crng_init(void) {}
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment