null_blk: prevent crash from bad home_node value

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>

authored by John Pittman and committed by Jens Axboe 7ff684a6 fd9c40f6

Changed files
+5
drivers
+5
drivers/block/null_blk_main.c
··· 1748 1748 return -EINVAL; 1749 1749 } 1750 1750 1751 + if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) { 1752 + pr_err("null_blk: invalid home_node value\n"); 1753 + g_home_node = NUMA_NO_NODE; 1754 + } 1755 + 1751 1756 if (g_queue_mode == NULL_Q_RQ) { 1752 1757 pr_err("null_blk: legacy IO path no longer available\n"); 1753 1758 return -EINVAL;