Skip to content

Commit 7ff684a

Browse files
jtpittman195axboe
authored andcommitted
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>
1 parent fd9c40f commit 7ff684a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/block/null_blk_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,11 @@ static int __init null_init(void)
17481748
return -EINVAL;
17491749
}
17501750

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+
17511756
if (g_queue_mode == NULL_Q_RQ) {
17521757
pr_err("null_blk: legacy IO path no longer available\n");
17531758
return -EINVAL;

0 commit comments

Comments
 (0)