]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/extra/0014-scsi-avoid-an-off-by-one-error-in-megasas_mmio_write.patch
bump version to 2.9.0-5
[pve-qemu.git] / debian / patches / extra / 0014-scsi-avoid-an-off-by-one-error-in-megasas_mmio_write.patch
CommitLineData
e74c0f31 1From c442fb4a11d8dc527c90bf90a1fd1b15646f4c57 Mon Sep 17 00:00:00 2001
90a6d957
WB
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Mon, 24 Apr 2017 17:36:34 +0530
e74c0f31 4Subject: [PATCH 14/23] scsi: avoid an off-by-one error in megasas_mmio_write
90a6d957
WB
5
6While reading magic sequence(MFI_SEQ) in megasas_mmio_write,
7an off-by-one error could occur as 's->adp_reset' index is not
8reset after reading the last sequence.
9
10Reported-by: YY Z <bigbird475958471@gmail.com>
11Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
12Message-Id: <20170424120634.12268-1-ppandit@redhat.com>
13Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
14---
15 hw/scsi/megasas.c | 10 +++++-----
16 1 file changed, 5 insertions(+), 5 deletions(-)
17
18diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
19index 84b8caf901..804122ab05 100644
20--- a/hw/scsi/megasas.c
21+++ b/hw/scsi/megasas.c
22@@ -2138,15 +2138,15 @@ static void megasas_mmio_write(void *opaque, hwaddr addr,
23 case MFI_SEQ:
24 trace_megasas_mmio_writel("MFI_SEQ", val);
25 /* Magic sequence to start ADP reset */
26- if (adp_reset_seq[s->adp_reset] == val) {
27- s->adp_reset++;
28+ if (adp_reset_seq[s->adp_reset++] == val) {
29+ if (s->adp_reset == 6) {
30+ s->adp_reset = 0;
31+ s->diag = MFI_DIAG_WRITE_ENABLE;
32+ }
33 } else {
34 s->adp_reset = 0;
35 s->diag = 0;
36 }
37- if (s->adp_reset == 6) {
38- s->diag = MFI_DIAG_WRITE_ENABLE;
39- }
40 break;
41 case MFI_DIAG:
42 trace_megasas_mmio_writel("MFI_DIAG", val);
43--
442.11.0
45