[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/47] 9pfs: fix crash in v9fs_walk()
From: |
Michael Roth |
Subject: |
[PATCH 12/47] 9pfs: fix crash in v9fs_walk() |
Date: |
Tue, 14 Dec 2021 18:00:50 -0600 |
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
v9fs_walk() utilizes the v9fs_co_run_in_worker({...}) macro to run the
supplied fs driver code block on a background worker thread.
When either the 'Twalk' client request was interrupted or if the client
requested fid for that 'Twalk' request caused a stat error then that
fs driver code block was left by 'break' keyword, with the intention to
return from worker thread back to main thread as well:
v9fs_co_run_in_worker({
if (v9fs_request_cancelled(pdu)) {
err = -EINTR;
break;
}
err = s->ops->lstat(&s->ctx, &dpath, &fidst);
if (err < 0) {
err = -errno;
break;
}
...
});
However that 'break;' statement also skipped the v9fs_co_run_in_worker()
macro's final and mandatory
/* re-enter back to qemu thread */
qemu_coroutine_yield();
call and thus caused the rest of v9fs_walk() to be continued being
executed on the worker thread instead of main thread, eventually
leading to a crash in the transport virtio transport driver.
To fix this issue and to prevent the same error from happening again by
other users of v9fs_co_run_in_worker() in future, auto wrap the supplied
code block into its own
do { } while (0);
loop inside the 'v9fs_co_run_in_worker' macro definition.
Full discussion and backtrace:
https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg05209.html
https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg00174.html
Fixes: 8d6cb100731c4d28535adbf2a3c2d1f29be3fef4
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <E1mLTBg-0002Bh-2D@lizzy.crudebyte.com>
(cherry picked from commit f83df00900816476cca41bb536e4d532b297d76e)
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
hw/9pfs/coth.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
index c51289903d..f83c7dda7b 100644
--- a/hw/9pfs/coth.h
+++ b/hw/9pfs/coth.h
@@ -51,7 +51,9 @@
*/ \
qemu_coroutine_yield(); \
qemu_bh_delete(co_bh); \
- code_block; \
+ do { \
+ code_block; \
+ } while (0); \
/* re-enter back to qemu thread */ \
qemu_coroutine_yield(); \
} while (0)
--
2.25.1
- [PATCH 00/47] Patch Round-up for stable 6.1.1, freeze on 2021-12-21, Michael Roth, 2021/12/14
- [PATCH 09/47] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr, Michael Roth, 2021/12/14
- [PATCH 10/47] hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write(), Michael Roth, 2021/12/14
- [PATCH 11/47] i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model, Michael Roth, 2021/12/14
- [PATCH 12/47] 9pfs: fix crash in v9fs_walk(),
Michael Roth <=
- [PATCH 13/47] plugins/execlog: removed unintended "s" at the end of log lines., Michael Roth, 2021/12/14
- [PATCH 14/47] plugins: do not limit exported symbols if modules are active, Michael Roth, 2021/12/14
- [PATCH 15/47] qemu-sockets: fix unix socket path copy (again), Michael Roth, 2021/12/14
- [PATCH 16/47] vhost-vsock: fix migration issue when seqpacket is supported, Michael Roth, 2021/12/14
- [PATCH 17/47] hw/arm/virt: Rename default_bus_bypass_iommu, Michael Roth, 2021/12/14
- [PATCH 18/47] hw/i386: Rename default_bus_bypass_iommu, Michael Roth, 2021/12/14
- [PATCH 19/47] bios-tables-test: allow changes in DSDT ACPI tables for q35, Michael Roth, 2021/12/14
- [PATCH 20/47] hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35, Michael Roth, 2021/12/14
- [PATCH 01/47] virtio-balloon: don't start free page hinting if postcopy is possible, Michael Roth, 2021/12/14
- [PATCH 21/47] bios-tables-test: Update ACPI DSDT table golden blobs for q35, Michael Roth, 2021/12/14