[PULL 16/28] hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state

Philippe Mathieu-Daudé posted 28 patches 3 months, 2 weeks ago
[PULL 16/28] hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state
Posted by Philippe Mathieu-Daudé 3 months, 2 weeks ago
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 <zheyuma97@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2454
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240730092138.32443-3-philmd@linaro.org>
---
 hw/sd/sd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
-- 
2.45.2


Re: [PULL 16/28] hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state
Posted by Michael Tokarev 3 months, 2 weeks ago
06.08.2024 15:51, Philippe Mathieu-Daudé wrote:
> 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")

This commit isn't in any released version, so the fix for it does not
apply, - so I'm not picking this up for stable.

JFYI.

Thanks,

/mjt

-- 
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt