[PATCH] hw/scsi: send error response when descriptor validation fails

Chinmay Rath posted 1 patch 1 day, 17 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261126075213.364201-1-rathc@linux.ibm.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Amit Machhiwal <amachhiw@linux.ibm.com>
hw/scsi/spapr_vscsi.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] hw/scsi: send error response when descriptor validation fails
Posted by Chinmay Rath 1 day, 17 hours ago
Commit 8a91c8327c (hw/scsi: validate IU buffer bounds in vscsi_preprocess_desc())
made vscsi_queue_cmd() cancel the request when vscsi_preprocess_desc()
fails. However, scsi_req_cancel() does not send an SRP response by
itself. That is to be sent from vscsi_request_cancelled(), only when
req->dma_error is set, which was missed in the above mentioned commit.

Fixing that in this commit, preventing the guest from hanging until
timeout.

Fixes: 8a91c8327cc8 ("hw/scsi: validate IU buffer bounds in vscsi_preprocess_desc()")
Suggested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Chinmay Rath <rathc@linux.ibm.com>
---
 hw/scsi/spapr_vscsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
index 1283590844..466f6d99e6 100644
--- a/hw/scsi/spapr_vscsi.c
+++ b/hw/scsi/spapr_vscsi.c
@@ -854,6 +854,7 @@ static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req)
 
         /* Preprocess RDMA descriptors */
         if (vscsi_preprocess_desc(req) < 0) {
+            req->dma_error = true;
             scsi_req_cancel(req->sreq);
             return 1;
         }
-- 
2.56.1