diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-13 22:27:40 +0000 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-14 02:09:44 +0000 |
commit | aa179935edea9a64dec4b757090c8106a3907ffa (patch) | |
tree | 57898482d3a5c86e00db5b23f1b4057e4376c597 /drivers/target | |
parent | 8e575c50a171f2579e367a7f778f86477dfdaf49 (diff) | |
download | op-kernel-dev-aa179935edea9a64dec4b757090c8106a3907ffa.zip op-kernel-dev-aa179935edea9a64dec4b757090c8106a3907ffa.tar.gz |
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>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_sbc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index b26b52f..17259c0 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -982,7 +982,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) } check_lba: end_lba = dev->transport->get_blocks(dev) + 1; - if (cmd->t_task_lba + sectors > end_lba) { + if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || + ((cmd->t_task_lba + sectors) > end_lba)) { pr_err("cmd exceeds last lba %llu " "(lba %llu, sectors %u)\n", end_lba, cmd->t_task_lba, sectors); |