Bufflen can be changed after scst_get_cdb_info(), so for bufflen = 0 data_direction should be changed to SCST_DATA_NONE not in scst_get_cdb_info(), but in the end of parsing.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@683 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-03-03 17:04:12 +00:00
parent d3d5666f5d
commit 982e4d1938
2 changed files with 8 additions and 8 deletions

View File

@@ -2020,14 +2020,6 @@ int scst_get_cdb_info(struct scst_cmd *cmd)
cmd->op_flags = ptr->flags;
res = (*ptr->get_trans_len)(cmd, ptr->off);
if (cmd->bufflen == 0) {
/*
* According to SPC bufflen 0 for data transfer commands isn't
* an error, so we need to fix the transfer direction.
*/
cmd->data_direction = SCST_DATA_NONE;
}
out:
TRACE_EXIT();
return res;

View File

@@ -526,6 +526,14 @@ static int scst_parse_cmd(struct scst_cmd *cmd)
if (cmd->data_len == -1)
cmd->data_len = cmd->bufflen;
if (cmd->bufflen == 0) {
/*
* According to SPC bufflen 0 for data transfer commands isn't
* an error, so we need to fix the transfer direction.
*/
cmd->data_direction = SCST_DATA_NONE;
}
if (cmd->dh_data_buf_alloced &&
unlikely((orig_bufflen > cmd->bufflen))) {
PRINT_ERROR("Dev handler supplied data buffer (size %d), "