Linfeng Sun
bd670e5dfd
vdpa_sim: fix cleanup after worker creation failure
...
vdpasim_create() leaves vdpasim->worker as an ERR_PTR when
kthread_run_worker() fails. The error path then drops the device
reference, which releases the partially initialized simulator.
vdpasim_free() unconditionally passes the worker pointer to
kthread_destroy_worker(), so the ERR_PTR is dereferenced and can trigger
a general protection fault.
Store the worker error, clear the pointer, and only clean up the worker
when it was successfully initialized. Also make the release path tolerate
partially initialized objects by guarding virtqueue and IOTLB cleanup,
since the same release path can be reached from other initialization
failures.
I found this bug myself, though the patch was written with AI assistance.
Fixes: 76acfa7bc5 ("vdpa_sim: use kthread worker")
Assisted-by: OpenAI-Codex:GPT-5
Reviewed-by: Eugenio Pérez <eperezma@redhat.com >
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gamil.com >
Message-ID: <20260620100959.2070316-1-slf@hdu.edu.cn >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2026-08-19 06:38:43 -04:00
..
2026-08-12 23:12:20 -07:00
2026-07-27 15:18:50 +02:00
2026-05-30 22:25:23 +02:00
2026-07-31 11:00:42 +02:00
2026-08-07 16:32:54 -07:00
2026-06-16 08:53:53 -07:00
2026-07-03 07:38:17 +02:00
2026-08-12 18:08:48 +01:00
2026-08-16 07:00:40 -07:00
2026-07-28 16:13:48 -04:00
2026-07-03 07:38:17 +02:00
2026-07-03 07:38:17 +02:00
2026-07-20 21:54:52 -06:00
2026-07-03 07:38:17 +02:00
2026-07-12 12:52:34 -07:00
2026-08-10 11:35:50 -07:00
2026-08-12 17:09:29 +02:00
2026-07-17 14:50:35 +02:00
2026-08-06 11:03:41 +02:00
2026-07-27 16:58:45 +02:00
2026-06-23 14:00:29 +02:00
2026-08-10 08:36:22 -07:00
2026-06-12 13:47:53 -07:00
2026-06-19 10:14:34 -07:00
2026-07-03 07:38:17 +02:00
2026-08-12 17:08:05 -07:00
2026-08-02 09:19:40 -07:00
2026-07-10 16:26:39 -07:00
2026-07-24 16:15:19 -07:00
2026-07-03 07:38:17 +02:00
2026-07-03 07:38:17 +02:00
2026-08-13 21:02:23 +09:00
2026-07-26 10:47:58 -07:00
2026-07-03 07:38:17 +02:00
2026-07-03 07:38:17 +02:00
2026-07-03 07:38:17 +02:00
2026-08-10 12:49:04 +02:00
2026-08-14 15:41:40 +10:00
2026-07-12 12:37:28 -07:00
2026-07-03 07:38:17 +02:00
2026-07-03 07:38:17 +02:00
2026-07-31 20:02:04 +00:00
2026-08-07 17:14:05 -07:00
2026-06-08 21:51:12 -05:00
2026-07-17 14:52:08 +02:00
2026-08-16 10:40:14 -07:00
2026-06-16 23:19:45 +02:00
2026-06-15 15:08:14 +05:30
2026-07-12 12:37:28 -07:00
2026-07-23 10:24:12 -07:00
2026-08-14 21:51:26 -07:00
2026-07-03 07:38:17 +02:00
2026-07-30 15:12:31 -07:00
2026-07-05 05:29:41 -10:00
2026-07-03 07:38:17 +02:00
2026-06-02 21:27:25 +02:00
2026-07-03 07:38:17 +02:00
2026-07-11 15:18:51 +02:00
2026-07-03 07:38:17 +02:00
2026-07-03 07:38:17 +02:00
2026-07-06 17:09:30 +02:00
2026-07-03 07:38:17 +02:00
2026-07-31 13:28:05 +02:00
2026-08-04 15:39:11 +02:00
2026-07-17 09:30:17 -07:00
2026-07-03 07:38:17 +02:00
2026-08-16 11:07:18 -07:00
2026-07-03 07:38:17 +02:00
2026-06-28 07:46:12 -07:00
2026-06-18 16:27:58 -07:00
2026-06-25 09:56:47 -07:00
2026-07-31 11:00:13 +02:00
2026-07-31 14:03:19 -07:00
2026-07-31 10:11:52 -07:00
2026-07-03 07:38:17 +02:00
2026-08-02 09:16:32 -07:00
2026-08-03 09:54:28 +02:00
2026-07-28 13:45:01 -07:00
2026-08-12 11:09:12 +02:00
2026-07-03 07:38:17 +02:00
2026-07-30 16:50:17 -07:00
2026-06-01 19:55:32 +02:00
2026-07-03 07:38:17 +02:00
2026-08-06 09:15:40 -07:00
2026-07-03 07:38:17 +02:00
2026-06-21 13:20:19 -07:00
2026-06-16 05:31:01 +05:30
2026-07-31 18:40:28 +01:00
2026-06-08 21:53:51 -05:00
2026-07-16 14:46:27 +01:00
2026-07-10 14:15:39 +02:00
2026-06-20 23:31:15 -07:00
2026-07-03 07:38:17 +02:00
2026-08-09 06:31:16 -07:00
2026-08-12 08:03:31 -07:00
2026-07-03 07:38:17 +02:00
2026-06-05 17:19:51 +02:00
2026-08-04 10:57:08 +02:00
2026-07-31 13:23:10 +01:00
2026-08-13 17:34:01 +01:00
2026-07-03 07:38:17 +02:00
2026-07-28 09:44:42 +02:00
2026-07-28 21:52:09 -04:00
2026-06-29 08:04:45 +02:00
2026-08-05 13:25:55 +02:00
2026-07-30 06:47:32 +02:00
2026-08-03 16:31:22 +02:00
2026-08-07 11:00:49 -04:00
2026-07-17 14:50:09 +02:00
2026-08-04 10:54:57 +02:00
2026-08-19 06:38:43 -04:00
2026-06-29 14:26:31 -06:00
2026-08-03 23:08:15 -04:00
2026-08-08 08:08:58 +02:00
2026-07-17 18:49:12 +01:00
2026-08-19 06:38:43 -04:00
2026-07-03 07:38:17 +02:00
2026-08-06 14:23:55 -07:00
2026-07-18 12:36:19 -07:00