|
|
cf91b1d |
From: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
cf91b1d |
Date: Tue, 24 May 2016 13:37:44 +0530
|
|
|
cf91b1d |
Subject: [PATCH] scsi: mptsas: infinite loop while fetching requests
|
|
|
cf91b1d |
|
|
|
cf91b1d |
The LSI SAS1068 Host Bus Adapter emulator in Qemu, periodically
|
|
|
cf91b1d |
looks for requests and fetches them. A loop doing that in
|
|
|
cf91b1d |
mptsas_fetch_requests() could run infinitely if 's->state' was
|
|
|
cf91b1d |
not operational. Move check to avoid such a loop.
|
|
|
cf91b1d |
|
|
|
cf91b1d |
Reported-by: Li Qiang <liqiang6-s@360.cn>
|
|
|
cf91b1d |
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
cf91b1d |
Cc: qemu-stable@nongnu.org
|
|
|
cf91b1d |
Message-Id: <1464077264-25473-1-git-send-email-ppandit@redhat.com>
|
|
|
cf91b1d |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
cf91b1d |
(cherry picked from commit 06630554ccbdd25780aa03c3548aaff1eb56dffd)
|
|
|
cf91b1d |
---
|
|
|
cf91b1d |
hw/scsi/mptsas.c | 9 ++++-----
|
|
|
cf91b1d |
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
cf91b1d |
|
|
|
cf91b1d |
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
|
|
|
cf91b1d |
index 499c146..be88e16 100644
|
|
|
cf91b1d |
--- a/hw/scsi/mptsas.c
|
|
|
cf91b1d |
+++ b/hw/scsi/mptsas.c
|
|
|
cf91b1d |
@@ -754,11 +754,6 @@ static void mptsas_fetch_request(MPTSASState *s)
|
|
|
cf91b1d |
hwaddr addr;
|
|
|
cf91b1d |
int size;
|
|
|
cf91b1d |
|
|
|
cf91b1d |
- if (s->state != MPI_IOC_STATE_OPERATIONAL) {
|
|
|
cf91b1d |
- mptsas_set_fault(s, MPI_IOCSTATUS_INVALID_STATE);
|
|
|
cf91b1d |
- return;
|
|
|
cf91b1d |
- }
|
|
|
cf91b1d |
-
|
|
|
cf91b1d |
/* Read the message header from the guest first. */
|
|
|
cf91b1d |
addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);
|
|
|
cf91b1d |
pci_dma_read(pci, addr, req, sizeof(hdr));
|
|
|
cf91b1d |
@@ -789,6 +784,10 @@ static void mptsas_fetch_requests(void *opaque)
|
|
|
cf91b1d |
{
|
|
|
cf91b1d |
MPTSASState *s = opaque;
|
|
|
cf91b1d |
|
|
|
cf91b1d |
+ if (s->state != MPI_IOC_STATE_OPERATIONAL) {
|
|
|
cf91b1d |
+ mptsas_set_fault(s, MPI_IOCSTATUS_INVALID_STATE);
|
|
|
cf91b1d |
+ return;
|
|
|
cf91b1d |
+ }
|
|
|
cf91b1d |
while (!MPTSAS_FIFO_EMPTY(s, request_post)) {
|
|
|
cf91b1d |
mptsas_fetch_request(s);
|
|
|
cf91b1d |
}
|