diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-01-18 08:04:29 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-07 01:32:39 -0500 |
commit | 95fe1ee41e23fa271416da67483594dde74bc6ca (patch) | |
tree | 6bfed9186c9fbec3954f4c9f590802ade39ffbe7 | |
parent | bf0053550aebe56f3bb5dd793e9de69238b5b945 (diff) |
target: accept REQUEST_SENSE with 18bytes
WindowsXP+BOT issues a MODE_SENSE request with page 0x1c which is not
suppoerted by target. Target rejects that command with
TCM_INVALID_CDB_FIELD, so far so good. On BOT I can't send the SENSE
response back, instead I can only reply that an error occured. The next
thing happens is a REQUEST_SENSE request with 18 bytes length. Since the
check here is more than 18 bytes I have to NACK that request as well.
This is not really required: We check for some additional room, but we
never use it. The additional length is set to 0xa so the total length is
0xa + 8 = 18 which is fine with my 18 bytes.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_cdb.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index a9bbf5a5cc27..f3d71fa88a28 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
@@ -1058,11 +1058,8 @@ int target_emulate_request_sense(struct se_task *task) | |||
1058 | */ | 1058 | */ |
1059 | buf[0] = 0x70; | 1059 | buf[0] = 0x70; |
1060 | buf[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; | 1060 | buf[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; |
1061 | /* | 1061 | |
1062 | * Make sure request data length is enough for additional | 1062 | if (cmd->data_length < 18) { |
1063 | * sense data. | ||
1064 | */ | ||
1065 | if (cmd->data_length <= 18) { | ||
1066 | buf[7] = 0x00; | 1063 | buf[7] = 0x00; |
1067 | err = -EINVAL; | 1064 | err = -EINVAL; |
1068 | goto end; | 1065 | goto end; |
@@ -1079,11 +1076,8 @@ int target_emulate_request_sense(struct se_task *task) | |||
1079 | */ | 1076 | */ |
1080 | buf[0] = 0x70; | 1077 | buf[0] = 0x70; |
1081 | buf[SPC_SENSE_KEY_OFFSET] = NO_SENSE; | 1078 | buf[SPC_SENSE_KEY_OFFSET] = NO_SENSE; |
1082 | /* | 1079 | |
1083 | * Make sure request data length is enough for additional | 1080 | if (cmd->data_length < 18) { |
1084 | * sense data. | ||
1085 | */ | ||
1086 | if (cmd->data_length <= 18) { | ||
1087 | buf[7] = 0x00; | 1081 | buf[7] = 0x00; |
1088 | err = -EINVAL; | 1082 | err = -EINVAL; |
1089 | goto end; | 1083 | goto end; |