1
0
Fork 0

random: fix possible sleeping allocation from irq context

commit 6c1e851c4e 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: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot+9de458f6a5e713ee8c1a@syzkaller.appspotmail.com
Fixes: 8ef35c866f ("random: set up the NUMA crng instances...")
Cc: stable@vger.kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/10/head
Theodore Ts'o 2018-04-23 18:51:28 -04:00 committed by Greg Kroah-Hartman
parent 812b51a630
commit ffc5b50a2b
1 changed files with 8 additions and 1 deletions

View File

@ -788,7 +788,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;
@ -809,6 +809,13 @@ static void numa_crng_init(void)
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
static void numa_crng_init(void) {}
#endif