]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] scsi_debug: fix buffer overrun when DIF/DIX is enabled and virtual_gb > 0
authorAkinobu Mita <akinobu.mita@gmail.com>
Wed, 18 Sep 2013 12:27:24 +0000 (21:27 +0900)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 25 Oct 2013 08:58:11 +0000 (09:58 +0100)
commit4bf2c73a5519a50761c7d95c5a1b45ec0ca22c77
treeb8de6350d53aa808588be7b566c27b56bba2d5d3
parent02f1c8a5c603e622725912c2f7434524600367a8
[SCSI] scsi_debug: fix buffer overrun when DIF/DIX is enabled and virtual_gb > 0

If the module parameter virtual_gb is greater than 0, the READ command
may request the blocks which exceed actual ramdisk storage (fake_storep).
prot_verify_read() should treat those blocks as wrap around the end of
fake_storep.  But it actually causes fake_storep and dif_storep buffer
overruns.

This fixes these buffer overruns.  In order to simplify the fix,
this also introduces fake_store() and dif_store() which return
corresponding wrap around addresses.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_debug.c