From: Markus Armbruster Date: Mon, 28 Jun 2010 17:10:36 +0000 (+0200) Subject: ide: Reject readonly drives unless CD-ROM X-Git-Tag: v0.13.0-rc0~88^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7aa9c811ca0761918a0252d0f923a80224953fa6;p=thirdparty%2Fqemu.git ide: Reject readonly drives unless CD-ROM drive_init() doesn't permit option readonly for if=ide, but that's worthless: we get it via if=none and -device. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- diff --git a/hw/ide/core.c b/hw/ide/core.c index dbb7accca0b..3b84bea5cf1 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2617,6 +2617,11 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM) { s->drive_kind = IDE_CD; bdrv_set_change_cb(bs, cdrom_change_cb, s); + } else { + if (bdrv_is_read_only(bs)) { + error_report("Can't use a read-only drive"); + return -1; + } } if (serial) { strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));