From: Philip J Kelleher <pjk1...@linux.vnet.ibm.com>

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 <pjk1...@linux.vnet.ibm.com>
-------------------------------------------------------------------------------


diff -uprN -X linux-block-vanilla/Documentation/dontdiff 
linux-block-vanilla/drivers/block/rsxx/dev.c 
linux-block/drivers/block/rsxx/dev.c
--- linux-block-vanilla/drivers/block/rsxx/dev.c        2013-06-18 
09:39:43.154903231 -0500
+++ linux-block/drivers/block/rsxx/dev.c        2013-06-18 09:44:02.210841168 
-0500
@@ -174,6 +174,9 @@ static void rsxx_make_request(struct req
        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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to