Commit 4d74fad8 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

vhost: fail I/Os with payload length = 0



We assumed the second descriptor in an I/O descriptor
chain will always point to a payload buffer, but in case
there is no payload, the second descriptor will point to
a response buffer. The vhost code doesn't provide proper
checks to handle such case, so to avoid various errors
down the stack, we just fail all requests with no
payload.

Change-Id: I6785c2843d6db4fc17e68e03562c2a1530bb469b
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/437187


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatar <dstepanov.src@gmail.com>
parent d555e546
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ process_blk_request(struct spdk_vhost_blk_task *task,
	switch (type) {
	case VIRTIO_BLK_T_IN:
	case VIRTIO_BLK_T_OUT:
		if (spdk_unlikely((payload_len & (512 - 1)) != 0)) {
		if (spdk_unlikely(payload_len == 0 || (payload_len & (512 - 1)) != 0)) {
			SPDK_ERRLOG("%s - passed IO buffer is not multiple of 512b (req_idx = %"PRIu16").\n",
				    type ? "WRITE" : "READ", task->req_idx);
			invalid_blk_request(task, VIRTIO_BLK_S_UNSUPP);