|
|
05bba0 |
From e6e48f3e4e46ec72d85cfa663425ec820d438f5b Mon Sep 17 00:00:00 2001
|
|
|
05bba0 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
05bba0 |
Date: Wed, 12 Aug 2015 14:18:40 +0200
|
|
|
05bba0 |
Subject: [PATCH 2/2] ide: Check validity of logical block size
|
|
|
05bba0 |
|
|
|
05bba0 |
Message-id: <1439389120-20473-2-git-send-email-kwolf@redhat.com>
|
|
|
05bba0 |
Patchwork-id: 67519
|
|
|
05bba0 |
O-Subject: [RHEL-7.2 qemu-kvm PATCH] ide: Check validity of logical block size
|
|
|
05bba0 |
Bugzilla: 1134670
|
|
|
05bba0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
05bba0 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
05bba0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
05bba0 |
|
|
|
05bba0 |
Our IDE emulation can't handle logical block sizes other than 512. Check
|
|
|
05bba0 |
for it.
|
|
|
05bba0 |
|
|
|
05bba0 |
The original assumption was that other values would silently be ignored
|
|
|
05bba0 |
(which is bad enough), but it's not quite true: The physical block size
|
|
|
05bba0 |
is exposed in IDENTIFY DEVICE as a multiple of the logical block size.
|
|
|
05bba0 |
Setting a logical block size therefore also corrupts the physical block
|
|
|
05bba0 |
size (4096/4096 doesn't silently downgrade to 4096/512, but 512/512).
|
|
|
05bba0 |
|
|
|
05bba0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
05bba0 |
Reviewed-by: Markus Armbruster <armbru@redhat.com>
|
|
|
05bba0 |
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
|
05bba0 |
(cherry picked from commit d20051856cd2fa8f10fed2d2a0b2751de5f7b20d)
|
|
|
05bba0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
05bba0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
05bba0 |
---
|
|
|
05bba0 |
hw/ide/qdev.c | 5 +++++
|
|
|
05bba0 |
1 file changed, 5 insertions(+)
|
|
|
05bba0 |
|
|
|
05bba0 |
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
|
|
|
05bba0 |
index 1d84e15..44f36c3 100644
|
|
|
05bba0 |
--- a/hw/ide/qdev.c
|
|
|
05bba0 |
+++ b/hw/ide/qdev.c
|
|
|
05bba0 |
@@ -159,6 +159,11 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
|
|
|
05bba0 |
return -1;
|
|
|
05bba0 |
}
|
|
|
05bba0 |
|
|
|
05bba0 |
+ if (dev->conf.logical_block_size != 512) {
|
|
|
05bba0 |
+ error_report("logical_block_size must be 512 for IDE");
|
|
|
05bba0 |
+ return -1;
|
|
|
05bba0 |
+ }
|
|
|
05bba0 |
+
|
|
|
05bba0 |
blkconf_serial(&dev->conf, &dev->serial);
|
|
|
05bba0 |
if (kind != IDE_CD
|
|
|
05bba0 |
&& blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255) < 0) {
|
|
|
05bba0 |
--
|
|
|
05bba0 |
1.8.3.1
|
|
|
05bba0 |
|