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