ide: Ignore reads during PIO in and writes during PIO out
authorKevin Wolf <kwolf@redhat.com>
Mon, 4 Jul 2011 12:07:50 +0000 (14:07 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 5 Jul 2011 09:23:42 +0000 (11:23 +0200)
commit5abeebb1306c520895fb72e66a9d0390c534f1f4
treed2f03e334df959dbcfa037867e38b2b1f2552cfb
parent12ab01d579e393e6fcd5c462b9069cc2863ad7bf
ide: Ignore reads during PIO in and writes during PIO out

This fixes https://bugs.launchpad.net/qemu/+bug/786209:

    When the DRQ_STAT bit is set, the IDE core permits both data reads
    and data writes, regardless of whether the current transfer was
    initiated as a read or write.

    This potentially leaks uninitialized host memory into the guest,
    if, before doing anything else to an IDE device, the guest begins a
    write transaction (e.g. WIN_WRITE), but then *reads* from the IO
    port instead of writing to it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
hw/ide/core.c