Skip to contentSkip to conversation

rsxx: Adapter address space sanity check.

PATCH New Philip J. Kelleher 1 participant 1 message Jun 18, 2013 Block layer

lore
Share & tools
lore
#0 lore raw

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

From: Philip J Kelleher <[email protected]>

Adding a sanity check to guarentee that DMAs outside of the device's address space will be errored out right away.

-------------------------------------------------------------------------------

drivers/block/rsxx/dev.c +3 -0
diff -uprN -X linux-block-vanilla/Documentation/dontdiff linux-block-vanilla/drivers/block/rsxx/dev.c linux-block/drivers/block/rsxx/dev.c
@@ -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;