Ross Golder
6a1dc8c694
rpc: refuse to queue a message that is already queued
...
virNetMessageQueuePush() appends by walking to the tail of the queue. If
it is handed a message which is already in that queue, and that message
happens to be the tail, it links the message to itself. The cycle then
makes virNetMessageQueueServe() return the same pointer on consecutive
calls, and callers which free what they are served - such as
virNetServerClientDispatchWrite() - free it twice, aborting the process
with "free(): invalid pointer".
Refuse such a push and warn instead, so that a caller bug shows up as a
diagnosable log message rather than as heap corruption some time later.
The check has to walk the queue rather than just test msg->next, because
virNetMessageClear() memsets the whole message: a queued message which
has been cleared appears unlinked while still being referenced.
Also break the cycle in virNetMessageQueueServe() if one is somehow
already present, rather than handing out the same message indefinitely,
and clear msg->next in virNetMessageFree() so a stale reference held by a
queue is detectable instead of dangling.
The accompanying test reproduces the self-cycle deterministically: with
the check removed it fails with "Message linked to itself".
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Signed-off-by: Ross Golder <ross@golder.org >
2026-08-27 12:38:53 +01:00
..
2025-11-08 10:27:56 +01:00
2026-08-24 11:35:58 +02:00
2026-08-24 11:35:58 +02:00
2026-08-10 13:33:33 +02:00
2023-08-25 10:07:36 +02:00
2023-02-14 13:59:45 +01:00
2022-12-01 14:22:39 +01:00
2026-05-20 16:39:44 +02:00
2025-04-01 16:18:30 +02:00
2025-04-01 16:18:30 +02:00
2026-08-12 14:57:45 +02:00
2023-03-06 20:55:49 +01:00
2026-08-20 17:11:49 +02:00
2025-06-09 15:12:39 +02:00
2025-04-03 15:47:52 -06:00
2024-11-26 14:36:14 +01:00
2026-07-16 13:04:45 +01:00
2026-03-17 17:24:59 +01:00
2026-07-16 13:04:45 +01:00
2024-02-26 11:09:57 +01:00
2026-02-11 18:26:39 +00:00
2025-02-05 17:56:42 +01:00
2025-07-18 15:57:02 +02:00
2026-01-16 12:45:07 +00:00
2023-06-05 13:23:06 +02:00
2023-06-05 13:23:06 +02:00
2023-07-20 15:23:34 +02:00
2026-02-03 15:34:52 +01:00
2026-08-20 17:11:49 +02:00
2026-05-06 10:47:13 +02:00
2023-07-20 15:23:43 +02:00
2023-07-20 15:23:24 +02:00
2026-02-24 11:29:07 +01:00
2026-06-22 16:46:19 +02:00
2026-03-18 14:23:53 +01:00
2026-03-18 14:23:53 +01:00
2024-01-07 23:59:00 -05:00
2024-09-24 08:24:00 +02:00
2025-09-08 15:32:48 +02:00
2024-02-09 14:45:20 -06:00
2026-07-27 13:38:37 +02:00
2024-07-10 12:32:23 +02:00
2025-07-25 15:36:21 +02:00
2026-08-20 17:11:49 +02:00
2022-11-03 09:19:54 +01:00
2022-07-01 14:51:19 +02:00
2022-07-01 16:53:08 +02:00
2022-09-01 13:11:09 +02:00
2022-09-01 13:11:09 +02:00
2024-03-12 10:34:43 +01:00
2022-09-01 13:11:09 +02:00
2022-09-01 13:11:09 +02:00
2025-07-14 14:14:36 +02:00
2023-04-06 12:48:22 +02:00
2024-09-13 12:57:42 +02:00
2026-05-04 09:05:34 +02:00
2026-06-22 16:42:36 +02:00
2026-01-05 15:15:25 +01:00
2024-09-24 08:24:00 +02:00
2023-01-02 20:39:09 +01:00
2026-03-18 14:23:39 +01:00
2024-09-13 12:57:42 +02:00
2026-08-20 17:11:49 +02:00
2026-08-14 16:54:31 +02:00
2026-02-11 18:05:36 +00:00
2023-12-14 17:10:22 +01:00
2026-06-22 14:29:43 +02:00
2026-04-24 11:29:01 +02:00
2025-03-07 13:00:10 +00:00
2024-11-15 09:42:04 +01:00
2022-08-25 13:27:04 +02:00
2023-07-20 11:22:08 +02:00
2025-11-08 10:27:56 +01:00
2026-02-12 19:18:35 +01:00
2026-08-21 13:43:35 +02:00
2026-08-21 13:43:35 +02:00
2024-03-12 17:37:51 +01:00
2024-03-12 17:37:51 +01:00
2023-11-24 09:53:14 +01:00
2024-05-23 14:32:24 +02:00
2026-05-14 14:25:28 +02:00
2026-02-17 13:14:58 +01:00
2026-06-09 14:10:53 +02:00
2022-06-16 06:43:58 +02:00
2022-12-01 14:22:39 +01:00
2026-03-09 01:58:08 -04:00
2024-05-08 15:57:31 +01:00
2026-03-09 01:58:08 -04:00
2026-05-15 14:02:17 +02:00
2022-06-16 06:43:58 +02:00
2024-05-08 16:01:34 +01:00
2025-04-03 15:47:52 -06:00
2022-06-16 06:43:58 +02:00
2026-07-06 11:39:53 -06:00
2023-08-25 12:36:37 +02:00
2026-01-29 13:38:45 +01:00
2026-07-16 13:04:45 +01:00
2026-07-16 13:04:45 +01:00
2025-02-05 17:56:42 +01:00
2025-02-05 17:56:42 +01:00
2025-07-02 13:54:04 +02:00
2023-08-03 16:41:19 +02:00
2022-12-01 14:22:39 +01:00
2026-01-16 12:45:07 +00:00
2023-06-05 13:23:06 +02:00
2022-06-16 06:43:58 +02:00
2022-12-01 14:22:39 +01:00
2022-05-24 12:19:18 +02:00
2026-08-17 12:47:19 +02:00
2026-06-03 15:21:44 +02:00
2023-04-03 09:19:06 +02:00
2023-04-03 09:19:07 +02:00
2026-06-18 11:03:35 +02:00
2024-02-01 10:39:40 +01:00
2025-03-13 15:38:16 +01:00
2026-06-02 13:45:26 +02:00
2026-03-18 13:57:16 +01:00
2026-03-18 13:57:16 +01:00
2026-03-18 14:23:21 +01:00
2026-03-18 14:23:21 +01:00
2026-02-24 11:29:07 +01:00
2026-05-25 13:28:58 +02:00
2026-06-22 16:46:19 +02:00
2026-03-18 13:57:16 +01:00
2024-09-24 08:24:00 +02:00
2024-06-06 09:29:58 +02:00
2026-06-08 02:28:50 -04:00
2026-06-22 16:46:18 +02:00
2026-06-22 16:46:18 +02:00
2024-02-09 14:45:20 -06:00
2026-03-09 01:58:08 -04:00
2025-06-24 16:29:12 +02:00
2024-07-10 12:32:23 +02:00
2026-06-10 11:23:52 +02:00
2026-06-18 11:03:36 +02:00
2026-08-20 17:11:49 +02:00
2023-03-03 13:52:37 +01:00
2022-06-16 06:43:58 +02:00
2022-10-06 10:54:24 +02:00
2026-03-09 01:58:08 -04:00
2024-10-16 15:47:52 +01:00
2024-10-16 15:47:52 +01:00
2022-02-15 09:32:23 +01:00
2026-02-12 15:55:30 +01:00
2025-05-02 09:31:27 +01:00
2022-10-06 10:54:24 +02:00
2022-10-06 10:54:24 +02:00
2022-10-06 10:54:24 +02:00
2025-07-14 14:14:36 +02:00
2026-06-10 11:23:52 +02:00
2026-06-10 11:23:52 +02:00
2025-05-22 15:23:22 +02:00
2022-06-16 06:43:58 +02:00
2022-06-16 06:43:58 +02:00
2026-06-18 11:03:35 +02:00
2026-06-10 11:23:52 +02:00
2024-10-01 12:53:49 +02:00
2024-06-06 09:29:58 +02:00
2023-04-03 09:19:07 +02:00
2025-06-09 15:12:38 +02:00
2022-12-01 14:22:39 +01:00
2023-04-06 12:48:22 +02:00
2022-06-16 06:43:58 +02:00
2025-04-16 09:56:51 +02:00
2022-12-01 14:22:39 +01:00
2024-09-13 12:57:42 +02:00
2026-03-09 01:58:08 -04:00
2026-05-04 09:05:34 +02:00
2022-06-16 06:43:58 +02:00
2026-02-12 17:07:58 +01:00
2022-01-18 15:19:47 +01:00
2022-06-16 06:43:58 +02:00
2022-06-16 06:43:58 +02:00
2023-04-01 11:40:35 +02:00
2026-03-09 01:58:08 -04:00
2025-12-10 13:12:07 +01:00
2025-07-02 13:54:04 +02:00
2023-05-10 14:44:22 +02:00
2025-12-02 12:35:51 +01:00
2022-09-30 15:38:47 +02:00
2026-05-14 12:13:09 +02:00
2026-03-09 01:58:08 -04:00
2024-10-16 15:47:52 +01:00
2025-05-02 09:31:27 +01:00
2024-08-16 13:11:57 +02:00
2022-06-16 06:43:58 +02:00
2025-05-02 09:31:27 +01:00
2022-06-16 06:43:58 +02:00
2024-09-24 08:24:00 +02:00
2022-06-16 06:43:58 +02:00
2024-03-14 15:17:48 +01:00
2026-03-09 01:58:08 -04:00
2026-03-09 01:58:08 -04:00
2026-05-19 13:12:02 +02:00
2026-03-09 13:13:47 +01:00
2025-05-02 09:31:28 +01:00
2023-03-13 13:29:07 +01:00
2026-08-27 12:38:53 +01:00
2023-08-03 16:35:11 +02:00
2025-11-24 15:05:09 +00:00
2026-03-09 01:58:08 -04:00
2025-11-24 15:05:09 +00:00
2024-01-04 22:26:10 +01:00
2023-03-15 12:46:21 +01:00
2022-10-06 10:54:24 +02:00
2026-03-09 13:13:47 +01:00
2024-01-31 17:24:07 +01:00
2024-01-31 17:24:07 +01:00
2026-03-09 01:58:08 -04:00
2022-06-16 06:43:58 +02:00
2023-07-19 13:09:11 +02:00
2024-09-13 12:57:42 +02:00
2026-07-16 13:04:45 +01:00
2026-03-09 01:58:08 -04:00
2023-06-29 11:51:27 +02:00
2024-09-05 15:24:55 +02:00
2026-08-14 16:54:31 +02:00
2022-06-16 06:43:58 +02:00
2025-12-02 12:41:41 +01:00
2026-03-09 01:58:08 -04:00
2025-07-02 13:54:38 +02:00
2026-03-09 01:58:08 -04:00
2026-01-02 10:56:31 +01:00
2024-10-01 12:57:02 +02:00
2023-02-08 16:50:45 +01:00
2025-07-02 13:54:04 +02:00
2026-02-11 18:24:54 +00:00
2025-11-20 15:09:10 +01:00
2026-06-22 14:29:43 +02:00
2026-04-24 11:29:01 +02:00
2024-05-02 15:57:29 -06:00
2024-05-02 15:57:29 -06:00
2022-08-25 13:27:04 +02:00