Skip to content

Commit 0d3a936

Browse files
kevmwYanVugenfirer
authored andcommitted
viostor: Fix MessageId update in MESSAGENUMBER_TO_QUEUE()
In the case that StorPortGetStartIoPerfParams() returns an optimal MessageNumber that is higher than the MessageNumber of the existing queues, MESSAGENUMBER_TO_QUEUE() tries to wrap around and assign queues in a round-robin fashion. While it does this correctly for QueueNumber, it fails to update MessageId correctly. The correct relation is MessageId = QueueNumber + 1, and this has to be ensured after limiting QueueNumber, too. The existing MessageId += 1 will make MessageId only more out of bounds for the array accesses it is used for amongst others in VioStorCompleteRequest() and VioStorVQLock/ Unlock(). This code path is hard to hit because normally, the MessageNumber returned by StorPortGetStartIoPerfParams() is limited to num_queues + 1 through the STOR_PERF_INTERRUPT_MESSAGE_RANGES feature. However, when I modified VirtIoHwInitialize() to not enable this feature, I got instant BSODs without this fix on a setup with 10 vcpus and virtio-blk configured with num-queues=2,vectors=10. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 parent c2af034 commit 0d3a936

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

viostor/virtio_stor_hw_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
if (QueueNumber >= adaptExt->num_queues) \
5454
{ \
5555
QueueNumber %= adaptExt->num_queues; \
56-
MessageId += 1; \
56+
MessageId = QueueNumber + 1; \
5757
} \
5858
} \
5959
}

0 commit comments

Comments
 (0)