Commit a5be12c3 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: check validity of SQSIZE in Connect



Change-Id: I8185ed25a3067bb8882bf47ce7a6d2cd0361c597
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 39cda187
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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) {