From: Philippe Mathieu-Daudé Date: Tue, 30 Jul 2024 07:44:46 +0000 (+0200) Subject: hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state X-Git-Tag: qemu-xen-4.20.0~30^2~12 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bd6207903eb81c0e876452bba25ed7d57ddf5f89;p=qemu-xen.git hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state Guest should not try to read the DAT lines from invalid command state. If it still insists to do so, return a dummy value. Cc: qemu-stable@nongnu.org Fixes: e2dec2eab0 ("hw/sd/sdcard: Remove default case in read/write on DAT lines") Reported-by: Zheyu Ma Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2454 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20240730092138.32443-3-philmd@linaro.org> --- diff --git a/hw/sd/sd.c b/hw/sd/sd.c index de27e34fc8..a140a32ccd 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2540,7 +2540,9 @@ uint8_t sd_read_byte(SDState *sd) break; default: - g_assert_not_reached(); + qemu_log_mask(LOG_GUEST_ERROR, "%s: DAT read illegal for command %s\n", + __func__, sd->last_cmd_name); + return dummy_byte; } return ret;