diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-09-17 19:36:11 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-09-17 20:13:39 -0400 |
commit | d81cb44726f050d7cf1be4afd9cb45d153b52066 (patch) | |
tree | 8c977e5217f7c40a5a6c9938a4acb73737c129a5 /drivers/target | |
parent | e0de44573637ba43e43ae1af042e109bbf2b6dd0 (diff) |
target: go through normal processing for all zero-length commands
Yay, all users of transport_kmap_data_sg now check for a zero-length
request and/or a too-small parameter list length. We can thus go through
the normal emulation path even for such commands.
This means that out-of-bounds reads and writes are now reported correctly
even if they transfer 0 blocks. Other errors are also reported correctly.
Testcase: sg_raw /dev/sdb 28 00 80 00 00 00 00 00 00 00
should fail with ILLEGAL REQUEST / LBA OUT OF RANGE sense
does not fail without the patch
(still wrong with the patch, but better: the ASC is INVALID FIELD IN CDB)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_transport.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 3cc76ad14ce2..221f67f3427c 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2289,23 +2289,6 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
2289 | if (ret < 0) | 2289 | if (ret < 0) |
2290 | goto out_fail; | 2290 | goto out_fail; |
2291 | } | 2291 | } |
2292 | /* | ||
2293 | * If this command doesn't have any payload and we don't have to call | ||
2294 | * into the fabric for data transfers, go ahead and complete it right | ||
2295 | * away. | ||
2296 | */ | ||
2297 | if (!cmd->data_length && | ||
2298 | cmd->t_task_cdb[0] != REQUEST_SENSE && | ||
2299 | cmd->se_dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV) { | ||
2300 | spin_lock_irq(&cmd->t_state_lock); | ||
2301 | cmd->t_state = TRANSPORT_COMPLETE; | ||
2302 | cmd->transport_state |= CMD_T_ACTIVE; | ||
2303 | spin_unlock_irq(&cmd->t_state_lock); | ||
2304 | |||
2305 | INIT_WORK(&cmd->work, target_complete_ok_work); | ||
2306 | queue_work(target_completion_wq, &cmd->work); | ||
2307 | return 0; | ||
2308 | } | ||
2309 | 2292 | ||
2310 | atomic_inc(&cmd->t_fe_count); | 2293 | atomic_inc(&cmd->t_fe_count); |
2311 | 2294 | ||