diff options
author | Philip J Kelleher <pjk1939@linux.vnet.ibm.com> | 2013-10-19 02:12:35 +0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-11-08 20:10:29 +0400 |
commit | 8c49a77ca451541938f90008f419fca965b76b72 (patch) | |
tree | 0b4ef99eeb6996ec70d6e203b03fc452732df52c /drivers/block/rsxx/dev.c | |
parent | e35f38bf73b6c9ec9521d9deb94198a419692db5 (diff) | |
download | linux-8c49a77ca451541938f90008f419fca965b76b72.tar.xz |
rsxx: Fix possible kernel panic with invalid config.
This patch fixes a possible Kernel Panic on driver load if
the configuration on the card is messed up or not yet set.
The driver could possible give a 32 bit unsigned all Fs to
the kernel as the device's block size.
Now we only write the block size to the kernel if the
configuration from the card is valid.
Also, driver version is being updated.
Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/rsxx/dev.c')
-rw-r--r-- | drivers/block/rsxx/dev.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c index d7af441880be..2284f5d3a54a 100644 --- a/drivers/block/rsxx/dev.c +++ b/drivers/block/rsxx/dev.c @@ -295,13 +295,15 @@ int rsxx_setup_dev(struct rsxx_cardinfo *card) return -ENOMEM; } - blk_size = card->config.data.block_size; + if (card->config_valid) { + blk_size = card->config.data.block_size; + blk_queue_dma_alignment(card->queue, blk_size - 1); + blk_queue_logical_block_size(card->queue, blk_size); + } blk_queue_make_request(card->queue, rsxx_make_request); blk_queue_bounce_limit(card->queue, BLK_BOUNCE_ANY); - blk_queue_dma_alignment(card->queue, blk_size - 1); blk_queue_max_hw_sectors(card->queue, blkdev_max_hw_sectors); - blk_queue_logical_block_size(card->queue, blk_size); blk_queue_physical_block_size(card->queue, RSXX_HW_BLK_SIZE); queue_flag_set_unlocked(QUEUE_FLAG_NONROT, card->queue); |