[stgt] [PATCH] Fix the LBA out of bounds check for VERIFY16

ronnie sahlberg ronniesahlberg at gmail.com
Sun Jun 24 10:23:18 CEST 2012


Tomo,

Please find a fix for VERIFY16 to avoid the LBA vs filesize check from
wrapping in 64 bit arithmetics.
For example we should compare LBA with filesize>>9,   not compare
lba<<9 with filesize since this can wrap.
We also have to be careful since lba+tl can wrap as well.

This is the same change as was earlier fixed for READ16/WRITE16 and friends.



With this patch the VERIFY16-LBA-OUT-OF-BOUNDS tests pass for tgtd :

$ ./bin/iscsi-test --dataloss --initiator-name=iqn.ronnie.test
--test="*verify16_beyondeol*" iscsi://127.0.0.1/iqn.ronnie.test/1
0273_verify16_beyond_eol:
========================
Verifying 2-256 blocks beyond end-of-device ... [OK]
Verify 1-256 blocks at LBA 2^63 ... [OK]
Verifying 1-256 blocks at LBA -1 ... [OK]
TEST T0273_verify16_beyondeol [OK]



regards
ronnie sahlberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SBC-Fix-the-LBA-out-of-range-check-in-VERIFY16.patch.gz
Type: application/x-gzip
Size: 815 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20120624/cc0612a5/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SBC-Fix-the-LBA-out-of-range-check-in-VERIFY16.patch
Type: application/octet-stream
Size: 1655 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20120624/cc0612a5/attachment-0001.obj>


More information about the stgt mailing list