Skip to content

Commit aa17993

Browse files
author
Nicholas Bellinger
committed
target: Check for LBA + sectors wrap-around in sbc_parse_cdb
This patch adds a check to sbc_parse_cdb() in order to detect when an LBA + sector vs. end-of-device calculation wraps when the LBA is sufficently large enough (eg: 0xFFFFFFFFFFFFFFFF). Cc: Martin Petersen <martin.petersen@oracle.com> Cc: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 8e575c5 commit aa17993

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/target/target_core_sbc.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
982982
}
983983
check_lba:
984984
end_lba = dev->transport->get_blocks(dev) + 1;
985-
if (cmd->t_task_lba + sectors > end_lba) {
985+
if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) ||
986+
((cmd->t_task_lba + sectors) > end_lba)) {
986987
pr_err("cmd exceeds last lba %llu "
987988
"(lba %llu, sectors %u)\n",
988989
end_lba, cmd->t_task_lba, sectors);

0 commit comments

Comments
 (0)