Skip to content

Commit

Permalink
null_blk: prevent crash from bad home_node value
Browse files Browse the repository at this point in the history
At module load, if the selected home_node value is greater than
the available numa nodes, the system will crash in
__alloc_pages_nodemask() due to a bad paging request.  Prevent this
user error crash by detecting the bad value, logging an error, and
setting g_home_node back to the default of NUMA_NO_NODE.

Signed-off-by: John Pittman <jpittman@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
jtpittman195 authored and axboe committed Apr 6, 2019
1 parent fd9c40f commit 7ff684a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/block/null_blk_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,6 +1748,11 @@ static int __init null_init(void)
return -EINVAL;
}

if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) {
pr_err("null_blk: invalid home_node value\n");
g_home_node = NUMA_NO_NODE;
}

if (g_queue_mode == NULL_Q_RQ) {
pr_err("null_blk: legacy IO path no longer available\n");
return -EINVAL;
Expand Down

0 comments on commit 7ff684a

Please sign in to comment.