Skip to content

Commit

Permalink
null_blk: Null pointer deference problem in alloc_page_buffers
Browse files Browse the repository at this point in the history
 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 <[email protected]>
Signed-off-by: Raghavendra K T <[email protected]>
Reviewed-by: Matias Bjorling <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
ktraghavendra authored and axboe committed Jan 22, 2014
1 parent 26d5805 commit 9967d8a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/block/null_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,11 @@ static int __init null_init(void)
irqmode = NULL_IRQ_NONE;
}
#endif
if (bs > PAGE_SIZE) {
pr_warn("null_blk: invalid block size\n");
pr_warn("null_blk: defaults block size to %lu\n", PAGE_SIZE);
bs = PAGE_SIZE;
}

if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
if (submit_queues < nr_online_nodes) {
Expand Down

0 comments on commit 9967d8a

Please sign in to comment.