Commit 6f5f7a3
admin: fix use-after-free in coord_request error path
When rd_kafka_admin_coord_request()'s request() call fails, the error
path called rd_kafka_admin_common_worker_destroy() which freed the
eonce object. However, the caller (rd_kafka_coord_req_fsm) still holds
a reference to the eonce and passes it to rd_kafka_coord_req_fail(),
which enqueues a dummy error response carrying the (now-freed) eonce
as opaque. When rd_kafka_admin_coord_response_parse() later processes
that response and calls rd_kafka_enq_once_del_source_return(), it
accesses freed memory, triggering an assertion failure and abort:
rd_kafka_enq_once_del_source_return: Assertion `eonce->refcnt > 0'
Fix by not calling worker_destroy() in the error path of
rd_kafka_admin_coord_request(). Instead, let the error propagate
through the normal coord_req_fail -> coord_response_parse path,
which already handles cleanup correctly.
This affects all coordinator-targeted Admin API operations:
DescribeConsumerGroups, DeleteConsumerGroupOffsets,
ListConsumerGroupOffsets, and similar.
Fixes #4605
Fixes #3663
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f1b831e commit 6f5f7a3
2 files changed
+27
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
1 | 17 | | |
2 | 18 | | |
3 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
484 | 483 | | |
485 | 484 | | |
486 | 485 | | |
| |||
500 | 499 | | |
501 | 500 | | |
502 | 501 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
508 | 513 | | |
509 | 514 | | |
510 | 515 | | |
| |||
0 commit comments