* [PATCH] hw/ide: resolve core crash caused by optical drive pop-up during virtual machine startup
@ 2026-03-20 2:07 yanlonglong
2026-03-20 6:57 ` Markus Armbruster
2026-03-20 7:08 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: yanlonglong @ 2026-03-20 2:07 UTC (permalink / raw)
To: qemu-devel; +Cc: yanlonglong
Signed-off-by: yanlonglong <yanlonglong@kylinos.cn>
---
hw/ide/atapi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index a42b748521..d14feed45b 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -153,6 +153,11 @@ static void cd_read_sector_cb(void *opaque, int ret)
static int cd_read_sector(IDEState *s)
{
void *buf;
+
+ //resolve core crash caused by optical drive pop-up during virtual machine startup
+ if (!blk_is_available(s->blk)) {
+ return -ENOMEDIUM;
+ }
if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) {
block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/ide: resolve core crash caused by optical drive pop-up during virtual machine startup
2026-03-20 2:07 [PATCH] hw/ide: resolve core crash caused by optical drive pop-up during virtual machine startup yanlonglong
@ 2026-03-20 6:57 ` Markus Armbruster
2026-03-20 7:08 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2026-03-20 6:57 UTC (permalink / raw)
To: yanlonglong; +Cc: qemu-devel, John Snow
Reproducer?
Is this a regression?
yanlonglong <yanlonglong@kylinos.cn> writes:
> Signed-off-by: yanlonglong <yanlonglong@kylinos.cn>
> ---
> hw/ide/atapi.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index a42b748521..d14feed45b 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -153,6 +153,11 @@ static void cd_read_sector_cb(void *opaque, int ret)
> static int cd_read_sector(IDEState *s)
> {
> void *buf;
> +
> + //resolve core crash caused by optical drive pop-up during virtual machine startup
docs/devel/style.rst:
We use traditional C-style /``*`` ``*``/ comments and avoid // comments.
> + if (!blk_is_available(s->blk)) {
> + return -ENOMEDIUM;
> + }
>
> if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) {
> block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/ide: resolve core crash caused by optical drive pop-up during virtual machine startup
2026-03-20 2:07 [PATCH] hw/ide: resolve core crash caused by optical drive pop-up during virtual machine startup yanlonglong
2026-03-20 6:57 ` Markus Armbruster
@ 2026-03-20 7:08 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-20 7:08 UTC (permalink / raw)
To: yanlonglong, qemu-devel; +Cc: qemu-block, John Snow
Hi,
Cc'ing maintainers:
$ ./scripts/get_maintainer.pl -f hw/ide/atapi.c
John Snow <jsnow@redhat.com> (odd fixer:IDE)
qemu-block@nongnu.org (open list:IDE)
qemu-devel@nongnu.org (open list:All patches CC here)
On 20/3/26 03:07, yanlonglong wrote:
> Signed-off-by: yanlonglong <yanlonglong@kylinos.cn>
> ---
> hw/ide/atapi.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index a42b748521..d14feed45b 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -153,6 +153,11 @@ static void cd_read_sector_cb(void *opaque, int ret)
> static int cd_read_sector(IDEState *s)
> {
> void *buf;
> +
> + //resolve core crash caused by optical drive pop-up during virtual machine startup
> + if (!blk_is_available(s->blk)) {
> + return -ENOMEDIUM;
> + }
IMHO we shouldn't reach this because drive ejection should cancel any
running transfer (with ide_transfer_stop IIRC). We could assert here:
assert(blk_is_available(s->blk));
to check the missing cancel transfer path.
> if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) {
> block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-20 7:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 2:07 [PATCH] hw/ide: resolve core crash caused by optical drive pop-up during virtual machine startup yanlonglong
2026-03-20 6:57 ` Markus Armbruster
2026-03-20 7:08 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox