From 271b6887d919f4cabf5f39358e3a6e93cacdd543 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 9 Mar 2009 19:24:32 +0000 Subject: [PATCH] Add handling of non-NONE data transfer direction commands with 0 buffer length in scst_user module. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@694 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_user.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 3aa6a5cef..2dda43e4c 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -791,6 +791,14 @@ static int dev_user_parse(struct scst_cmd *cmd) } alloc: + 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->data_direction != SCST_DATA_NONE) res = dev_user_alloc_space(ucmd);