[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 40/55] ide: Fix segfault when flushing a device that
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 40/55] ide: Fix segfault when flushing a device that doesn't exist |
Date: |
Fri, 15 Aug 2014 18:06:47 +0100 |
From: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/ide/core.c | 4 +++-
tests/ide-test.c | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index bdb0a80..82dd4af 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -848,7 +848,9 @@ static void ide_flush_cb(void *opaque, int ret)
}
}
- bdrv_acct_done(s->bs, &s->acct);
+ if (s->bs) {
+ bdrv_acct_done(s->bs, &s->acct);
+ }
s->status = READY_STAT | SEEK_STAT;
ide_cmd_done(s);
ide_set_irq(s->bus);
diff --git a/tests/ide-test.c b/tests/ide-test.c
index a77a037..ffce6ed 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -564,6 +564,19 @@ static void test_retry_flush(void)
ide_test_quit();
}
+static void test_flush_nodev(void)
+{
+ ide_test_start("");
+
+ /* FLUSH CACHE command on device 0*/
+ outb(IDE_BASE + reg_device, 0);
+ outb(IDE_BASE + reg_command, CMD_FLUSH_CACHE);
+
+ /* Just testing that qemu doesn't crash... */
+
+ ide_test_quit();
+}
+
int main(int argc, char **argv)
{
const char *arch = qtest_get_arch();
@@ -601,6 +614,7 @@ int main(int argc, char **argv)
qtest_add_func("/ide/bmdma/teardown", test_bmdma_teardown);
qtest_add_func("/ide/flush", test_flush);
+ qtest_add_func("/ide/flush_nodev", test_flush_nodev);
qtest_add_func("/ide/retry/flush", test_retry_flush);
--
1.9.3
- [Qemu-devel] [PULL 31/55] channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK), (continued)
- [Qemu-devel] [PULL 31/55] channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK), Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 32/55] dataplane: print why starting failed, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 35/55] parallels: extend parallels format header with actual data values, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 27/55] cmd646: switch cmd646_update_irq() to accept PCIDevice instead of PCIIDEState, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 36/55] parallels: replace tabs with spaces in block/parallels.c, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 29/55] cmd646: synchronise UDMA interrupt status with DMA interrupt status, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 33/55] dataplane: fail notifier setting gracefully, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 37/55] parallels: split check for parallels format in parallels_open, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 34/55] dataplane: stop trying on notifier error, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 38/55] parallels: 2TB+ parallels images support, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 40/55] ide: Fix segfault when flushing a device that doesn't exist,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 39/55] qemu-options: add missing -drive discard option to cmdline help, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 30/55] qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK), Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 41/55] libqtest: add QTEST_LOG for debugging qtest testcases, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 42/55] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 45/55] ide: only constrain read/write requests to drive size, not other types, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 43/55] libqos: Change free function called in malloc, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 44/55] virtio-blk: Correct bug in support for flexible descriptor layout, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 46/55] docs: Specification for the image fuzzer, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 47/55] image-fuzzer: Tool for fuzz tests execution, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 48/55] image-fuzzer: Fuzzing functions for qcow2 images, Stefan Hajnoczi, 2014/08/15