nvmf/vfio-user: add one more CQID check when creating SQ
Change-Id: I0099dee4de0f6948b5257e38c440029de3a6dc4e Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9172 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
94292a7513
commit
9b1372803b
@ -1153,6 +1153,13 @@ handle_create_io_q(struct nvmf_vfio_user_ctrlr *ctrlr,
|
|||||||
io_q->iv = cmd->cdw11_bits.create_io_cq.iv;
|
io_q->iv = cmd->cdw11_bits.create_io_cq.iv;
|
||||||
io_q->phase = true;
|
io_q->phase = true;
|
||||||
} else {
|
} else {
|
||||||
|
if (cmd->cdw11_bits.create_io_sq.cqid == 0) {
|
||||||
|
SPDK_ERRLOG("%s: invalid CQID 0\n", ctrlr_id(ctrlr));
|
||||||
|
sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
|
||||||
|
sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER;
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
}
|
||||||
/* CQ must be created before SQ */
|
/* CQ must be created before SQ */
|
||||||
if (!lookup_io_q(ctrlr, cmd->cdw11_bits.create_io_sq.cqid, true)) {
|
if (!lookup_io_q(ctrlr, cmd->cdw11_bits.create_io_sq.cqid, true)) {
|
||||||
SPDK_ERRLOG("%s: CQ%d does not exist\n", ctrlr_id(ctrlr),
|
SPDK_ERRLOG("%s: CQ%d does not exist\n", ctrlr_id(ctrlr),
|
||||||
@ -1162,13 +1169,13 @@ handle_create_io_q(struct nvmf_vfio_user_ctrlr *ctrlr,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_q = &ctrlr->qp[qid]->sq;
|
|
||||||
if (cmd->cdw11_bits.create_io_sq.pc != 0x1) {
|
if (cmd->cdw11_bits.create_io_sq.pc != 0x1) {
|
||||||
SPDK_ERRLOG("%s: non-PC SQ not supported\n", ctrlr_id(ctrlr));
|
SPDK_ERRLOG("%s: non-PC SQ not supported\n", ctrlr_id(ctrlr));
|
||||||
sc = SPDK_NVME_SC_INVALID_CONTROLLER_MEM_BUF;
|
sc = SPDK_NVME_SC_INVALID_CONTROLLER_MEM_BUF;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
io_q = &ctrlr->qp[qid]->sq;
|
||||||
io_q->cqid = cmd->cdw11_bits.create_io_sq.cqid;
|
io_q->cqid = cmd->cdw11_bits.create_io_sq.cqid;
|
||||||
SPDK_DEBUGLOG(nvmf_vfio, "%s: SQ%d CQID=%d\n", ctrlr_id(ctrlr),
|
SPDK_DEBUGLOG(nvmf_vfio, "%s: SQ%d CQID=%d\n", ctrlr_id(ctrlr),
|
||||||
qid, io_q->cqid);
|
qid, io_q->cqid);
|
||||||
|
Loading…
Reference in New Issue
Block a user