From 1958d41c7db1f415f84cb3ef316708ca83e6e72f Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Fri, 25 Apr 2014 17:54:05 +0200
Subject: [PATCH 12/12] ide: Correct improper smart self test counter reset in ide core.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1398448445-17245-2-git-send-email-armbru@redhat.com>
Patchwork-id: 58568
O-Subject: [PATCH 7.0 qemu-kvm 1/1] ide: Correct improper smart self test counter reset in ide core.
Bugzilla: 1087980
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Fam Zheng <famz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
From: BenoƮt Canet <benoit.canet@irqsave.net>
The SMART self test counter was incorrectly being reset to zero,
not 1. This had the effect that on every 21st SMART EXECUTE OFFLINE:
* We would write off the beginning of a dynamically allocated buffer
* We forgot the SMART history
Fix this.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
Message-id: 1397336390-24664-1-git-send-email-benoit.canet@irqsave.net
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Cc: qemu-stable@nongnu.org
Acked-by: Kevin Wolf <kwolf@redhat.com>
[PMM: tweaked commit message as per suggestions from Markus]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 940973ae0b45c9b6817bab8e4cf4df99a9ef83d7)
Conflicts:
hw/ide/core.c
CVE-2014-2894
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/ide/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/ide/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index c172c71..0313250 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1617,7 +1617,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
case 2: /* extended self test */
s->smart_selftest_count++;
if(s->smart_selftest_count > 21)
- s->smart_selftest_count = 0;
+ s->smart_selftest_count = 1;
n = 2 + (s->smart_selftest_count - 1) * 24;
s->smart_selftest_data[n] = s->sector;
s->smart_selftest_data[n+1] = 0x00; /* OK and finished */
--
1.7.1