Skip to content

Commit 1dccef2

Browse files
chorkinigaw
authored andcommitted
mi: nvme_mi_mi_xfer() is overly restrictive
MI commands may be unaligned and also have payloads that are being sent and received at the same command. One case of this is AEM Sync. This wasn't seen before because that particular path does not use nvme_mi_mi_xfer(). Signed-off-by: Chuck Horkin <chorkin@microsoft.com>
1 parent b07041b commit 1dccef2

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

src/nvme/mi.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,19 +1742,6 @@ int nvme_mi_mi_xfer(nvme_mi_ep_t ep,
17421742
return -1;
17431743
}
17441744

1745-
/* request and response lengths & offset must be aligned */
1746-
if ((req_data_size & 0x3) ||
1747-
(*resp_data_size & 0x3)) {
1748-
errno = EINVAL;
1749-
return -1;
1750-
}
1751-
1752-
/* bidirectional not permitted */
1753-
if (req_data_size && *resp_data_size) {
1754-
errno = EINVAL;
1755-
return -1;
1756-
}
1757-
17581745
mi_req->hdr.type = NVME_MI_MSGTYPE_NVME;
17591746
mi_req->hdr.nmp = (NVME_MI_ROR_REQ << 7) |
17601747
(NVME_MI_MT_MI << 3) |

test/mi.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -649,26 +649,10 @@ static void test_mi_invalid_formats(nvme_mi_ep_t ep)
649649
ctrl = nvme_mi_init_ctrl(ep, 1);
650650
assert(ctrl);
651651

652-
/* unaligned req size */
653-
len = 0;
654-
655-
rc = nvme_mi_mi_xfer(ep, &req.hdr, 1, &resp, &len);
656-
assert(rc != 0);
657-
658-
/* unaligned resp size */
659-
len = 1;
660-
rc = nvme_mi_mi_xfer(ep, &req.hdr, 0, &resp, &len);
661-
assert(rc != 0);
662-
663652
/* resp too large */
664653
len = 4096 + 4;
665654
rc = nvme_mi_mi_xfer(ep, &req.hdr, 0, &resp, &len);
666655
assert(rc != 0);
667-
668-
/* req and resp payloads */
669-
len = 4;
670-
rc = nvme_mi_mi_xfer(ep, &req.hdr, 4, &resp, &len);
671-
assert(rc != 0);
672656
}
673657

674658
/* test: header length too small */

0 commit comments

Comments
 (0)