Skip to content

io: fix mem leak when using QIOTask in TLS and websock channels

Daniel P. Berrangé qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3io: separate freeing of tasks from marking them as completeinclude/io/task.h io/channel-tls.c io/channel-websock.c +2 more+60 -101 reply
2/3io: fix cleanup for TLS I/O source data on cancellationio/channel-tls.c+40 -241 reply
3/3io: fix cleanup for websock I/O source data on cancellationio/channel-websock.c+1 -41 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMarc-André Lureau
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] io: fix mem leak when using QIOTask in TLS and websock channels

The handshake functions in the TLS and websock channels could leak a QIOTask and some related data if the underlying channel was torn down before the handshake completed. This also applies to the async TLS "bye" tasks.

Fixing this required refactoring the QIOTask cleanup paradigm slightly.

This is a followup to a proposed fix at

https://lists.nongnu.org/archive/html/qemu-devel/2025-09/msg02984.html

and also reported at

https://gitlab.com/qemu-project/qemu/-/issues/3114

Daniel P. Berrangé (3):
io: separate freeing of tasks from marking them as complete
io: fix cleanup for TLS I/O source data on cancellation
io: fix cleanup for websock I/O source data on cancellation

 include/io/task.h         | 29 +++++++++++++------
 io/channel-tls.c          | 60 ++++++++++++++++++++++++++-------------
 io/channel-websock.c      |  2 +-
 io/task.c                 |  8 ++++--
 tests/unit/test-io-task.c | 26 +++++++++++++++++
 5 files changed, 94 insertions(+), 31 deletions(-)
Signature · 1 line
2.52.0