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