aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorRaghavendra K T <raghavendra.kt@linux.vnet.ibm.com>2014-01-21 06:29:59 -0500
committerJens Axboe <axboe@kernel.dk>2014-01-21 23:22:40 -0500
commit9967d8ac5c0f3e730a21abefe4c889c724f3b212 (patch)
tree0eb48ed7aa3c5f5b374545c814a402392d3c6a1e /drivers/block
parent26d580575b4b8c3c83137315c9a2a77e60a2f716 (diff)
null_blk: Null pointer deference problem in alloc_page_buffers
If we load the null_blk module with bs=8k we get following oops: [ 3819.812190] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 [ 3819.812387] IP: [<ffffffff81170aa5>] create_empty_buffers+0x28/0xaf [ 3819.812527] PGD 219244067 PUD 215a06067 PMD 0 [ 3819.812640] Oops: 0000 [#1] SMP [ 3819.812772] Modules linked in: null_blk(+) Fix that by resetting block size to PAGE_SIZE if it is greater than PAGE_SIZE Reported-by: Sumanth <sumantk2@linux.vnet.ibm.com> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> Reviewed-by: Matias Bjorling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/null_blk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index a2e69d26266d..a01d7f68fc77 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -622,6 +622,11 @@ static int __init null_init(void)
622 irqmode = NULL_IRQ_NONE; 622 irqmode = NULL_IRQ_NONE;
623 } 623 }
624#endif 624#endif
625 if (bs > PAGE_SIZE) {
626 pr_warn("null_blk: invalid block size\n");
627 pr_warn("null_blk: defaults block size to %lu\n", PAGE_SIZE);
628 bs = PAGE_SIZE;
629 }
625 630
626 if (queue_mode == NULL_Q_MQ && use_per_node_hctx) { 631 if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
627 if (submit_queues < nr_online_nodes) { 632 if (submit_queues < nr_online_nodes) {