[PATCH 8/11] rsxx: Adapter address space sanity check.

From: Philip J. Kelleher
Date: Tue Jun 18 2013 - 15:49:18 EST


From: Philip J Kelleher <pjk1939@xxxxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxx>
-------------------------------------------------------------------------------


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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/