rsxx: Adapter address space sanity check.
authorPhilip J Kelleher <pjk1939@linux.vnet.ibm.com>
Tue, 18 Jun 2013 19:48:38 +0000 (14:48 -0500)
committerJens Axboe <axboe@kernel.dk>
Wed, 19 Jun 2013 11:52:10 +0000 (13:52 +0200)
Adding a sanity check to guarentee that DMAs outside of the device's
address space will be errored out right away.

Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/rsxx/dev.c

index a092f58..d7af441 100644 (file)
@@ -174,6 +174,9 @@ static void rsxx_make_request(struct request_queue *q, struct bio *bio)
        if (!card)
                goto req_err;
 
+       if (bio->bi_sector + (bio->bi_size >> 9) > get_capacity(card->gendisk))
+               goto req_err;
+
        if (unlikely(card->halt)) {
                st = -EFAULT;
                goto req_err;