On 10/30/26 15:44, Junjie Cao wrote:
ct3d_reset() re-runs cxl_init_cci() on all three CCIs, and each run
allocates a fresh background timer without freeing the old one, so
every reset leaks three QEMUTimers.  ct3_exit() doesn't free them
either.

Upstream fixed this in 259b877eac36 ("hw/cxl: fix timer leak in
cxl_destroy_cci()") and a004df0be51f ("hw/cxl: destroy primary CCI
before re-initialization on reset"), but both rely on
cxl_destroy_cci() and the .initialized flag from 98cbac128f1c, which
only went in for 10.1.  Add a minimal cxl_destroy_cci() here and call
it before each re-init and from ct3_exit().  timer_free() takes NULL,
so the first reset needs no guard.

ASan on v10.0.15, 5x system_reset on a paused guest with one
cxl-type3: 720 bytes in 15 allocations from cxl_init_cci ->
timer_new_ms before, none after.  cxl-test passes.

Fixes: 221d2cfbdb53 ("hw/cxl/mbox: Add support for background operations")
Cc: [email protected]
Signed-off-by: Junjie Cao <[email protected]>

Thank you for all yout work and for helping with back-porting this to 10.0.
I haven't get back to you at the time, correcting now :)

/mjt

Reply via email to