diff options
author | limiao-intel <105205746+limiao-intel@users.noreply.github.com> | 2023-06-09 04:51:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-08 21:51:04 +0100 |
commit | 74e7348f253c04d43c11082c83f2a51720c7643e (patch) | |
tree | f6f24b896e9846c36b9a688f3a8c2caab3d3d7d8 /test | |
parent | e817d2e67835a80761fd33c4a1ed445c3309f3e7 (diff) | |
download | libvfio-user-74e7348f253c04d43c11082c83f2a51720c7643e.zip libvfio-user-74e7348f253c04d43c11082c83f2a51720c7643e.tar.gz libvfio-user-74e7348f253c04d43c11082c83f2a51720c7643e.tar.bz2 |
fix err/req irq fd issue (#731)
When handle_device_set_irqs set err irq/req irq, fd will be filled
in vfu_ctx->irqs->efds[] rather than vfu_ctx->irqs->err_efd or
vfu_ctx->irqs->req_efd. This patch adds irq index judgment before
filling in fd to make sure fd is filled in the correct place.
Signed-off-by: Miao Li <miao.li@intel.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/py/test_device_set_irqs.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/py/test_device_set_irqs.py b/test/py/test_device_set_irqs.py index 4118cb2..1aead71 100644 --- a/test/py/test_device_set_irqs.py +++ b/test/py/test_device_set_irqs.py @@ -151,6 +151,24 @@ def test_device_set_irqs_bad_action_for_req_irq(): expect=errno.EINVAL) +def test_device_set_irqs_bad_start_count_range_for_err_irq(): + payload = vfio_irq_set(argsz=argsz, flags=VFIO_IRQ_SET_ACTION_TRIGGER | + VFIO_IRQ_SET_DATA_NONE, index=VFU_DEV_ERR_IRQ, + start=0, count=2) + + msg(ctx, sock, VFIO_USER_DEVICE_SET_IRQS, payload, + expect=errno.EINVAL) + + +def test_device_set_irqs_bad_start_count_range_for_req_irq(): + payload = vfio_irq_set(argsz=argsz, flags=VFIO_IRQ_SET_ACTION_TRIGGER | + VFIO_IRQ_SET_DATA_NONE, index=VFU_DEV_REQ_IRQ, + start=0, count=2) + + msg(ctx, sock, VFIO_USER_DEVICE_SET_IRQS, payload, + expect=errno.EINVAL) + + def test_device_set_irqs_bad_start_for_count_0(): payload = vfio_irq_set(argsz=argsz, flags=VFIO_IRQ_SET_ACTION_MASK | VFIO_IRQ_SET_DATA_NONE, index=VFU_DEV_MSIX_IRQ, |