mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 11:11:27 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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), "
|
||||
|
||||
Reference in New Issue
Block a user