nvmf: check validity of SQSIZE in Connect

Change-Id: I8185ed25a3067bb8882bf47ce7a6d2cd0361c597
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-05 09:41:34 -07:00
parent 39cda18718
commit a5be12c376

View File

@ -218,6 +218,16 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn,
return;
}
/*
* SQSIZE is a 0-based value, so it must be at least 1 (minimum queue depth is 2) and
* strictly less than max_queue_depth.
*/
if (cmd->sqsize == 0 || cmd->sqsize >= g_nvmf_tgt.max_queue_depth) {
SPDK_ERRLOG("Invalid SQSIZE %u (min 1, max %u)\n",
cmd->sqsize, g_nvmf_tgt.max_queue_depth - 1);
INVALID_CONNECT_CMD(sqsize);
return;
}
conn->sq_head_max = cmd->sqsize;
if (cmd->qid == 0) {