From: John Snow Date: Wed, 10 Feb 2016 18:29:38 +0000 (-0500) Subject: ide: Prohibit RESET on IDE drives X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=266e77812ce1630f3f3ff02aadccb151aa01e6f6;p=people%2Fliuw%2Flibxenctrl-split%2Fqemu-xen.git ide: Prohibit RESET on IDE drives This command is meant for ATAPI devices only, prohibit acknowledging it with a command aborted response when an IDE device is busy. Signed-off-by: John Snow Reported-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Message-id: 1453225191-11871-2-git-send-email-jsnow@redhat.com --- diff --git a/hw/ide/core.c b/hw/ide/core.c index 4c46453e2..88d5fabcf 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1877,9 +1877,13 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) return; } - /* Only DEVICE RESET is allowed while BSY or/and DRQ are set */ - if ((s->status & (BUSY_STAT|DRQ_STAT)) && val != WIN_DEVICE_RESET) - return; + /* Only RESET is allowed while BSY and/or DRQ are set, + * and only to ATAPI devices. */ + if (s->status & (BUSY_STAT|DRQ_STAT)) { + if (val != WIN_DEVICE_RESET || s->drive_kind != IDE_CD) { + return; + } + } if (!ide_cmd_permitted(s, val)) { ide_abort_command(s);