thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 6c6316c53a1e2ddd34c31ecf5d757646482c4202 Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Tue, 5 Nov 2013 14:09:15 +0100
9ae3a8
Subject: [PATCH 62/87] sd: Avoid access to NULL BlockDriverState
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Message-id: <1383660558-32096-22-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 55400
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 21/24] sd: Avoid access to NULL BlockDriverState
9ae3a8
Bugzilla: 978402
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
From: Andreas Färber <afaerber@suse.de>
9ae3a8
9ae3a8
Commit 4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf (blockdev: Remove IF_*
9ae3a8
check for read-only blockdev_init) added a usage of bdrv_is_read_only()
9ae3a8
to sd_init(), which is called for versatilepb, versatileab and
9ae3a8
xilinx-zynq-a9 machines among others with NULL argument by default,
9ae3a8
causing the new qom-test to fail.
9ae3a8
9ae3a8
Add a check to prevent this.
9ae3a8
9ae3a8
Suggested-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Signed-off-by: Andreas Färber <afaerber@suse.de>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 794cbc26eb94ce13c75d105eea9ff0afff56e2c2)
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 hw/sd/sd.c | 2 +-
9ae3a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/sd/sd.c |    2 +-
9ae3a8
 1 files changed, 1 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
9ae3a8
index e816c78..c9651b9 100644
9ae3a8
--- a/hw/sd/sd.c
9ae3a8
+++ b/hw/sd/sd.c
9ae3a8
@@ -492,7 +492,7 @@ SDState *sd_init(BlockDriverState *bs, bool is_spi)
9ae3a8
 {
9ae3a8
     SDState *sd;
9ae3a8
 
9ae3a8
-    if (bdrv_is_read_only(bs)) {
9ae3a8
+    if (bs && bdrv_is_read_only(bs)) {
9ae3a8
         fprintf(stderr, "sd_init: Cannot use read-only drive\n");
9ae3a8
         return NULL;
9ae3a8
     }
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8