summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorJohn Pittman <jpittman@redhat.com>2019-04-06 00:42:45 +0300
committerJens Axboe <axboe@kernel.dk>2019-04-06 19:51:08 +0300
commit7ff684a683d777c4956fce93e60accbab2bd7696 (patch)
tree28d71c37e524712b89d51d72a15586baa0661f0b /drivers/block
parentfd9c40f64c514bdc585a21e2e33fa5f83ca8811b (diff)
downloadlinux-7ff684a683d777c4956fce93e60accbab2bd7696.tar.xz
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>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/null_blk_main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 417a9f15c116..d7ac09c092f2 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -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;