nvmf/vfio-user: check invalid minimal qsize when creating IO SQ/CQ

Fix issue #2175.

Change-Id: I89365f2c482026c0a0313c4e27a802c0a66bebef
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9606
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-09-24 20:15:22 +08:00
parent 091aa2b681
commit 232ed2a3d3

View File

@ -1123,9 +1123,8 @@ handle_create_io_q(struct nvmf_vfio_user_ctrlr *ctrlr,
}
qsize = cmd->cdw10_bits.create_io_q.qsize + 1;
if (qsize > max_queue_size(ctrlr)) {
SPDK_ERRLOG("%s: queue too big, want=%u, max=%u\n", ctrlr_id(ctrlr),
qsize, max_queue_size(ctrlr));
if (qsize == 1 || qsize > max_queue_size(ctrlr)) {
SPDK_ERRLOG("%s: invalid I/O queue size %u\n", ctrlr_id(ctrlr), qsize);
sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
sc = SPDK_NVME_SC_INVALID_QUEUE_SIZE;
goto out;