On 29.09.25 16:42, Peter Maydell wrote:
From: Peter Xu <[email protected]>

If an AddressSpace has been created in its own allocated
memory, cleaning it up requires first destroying the AS
and then freeing the memory. Doing this doesn't work:

     address_space_destroy(as);
     g_free_rcu(as, rcu);

because both address_space_destroy() and g_free_rcu()
try to use the same 'rcu' node in the AddressSpace struct
and the address_space_destroy hook gets overwritten.

Provide a new address_space_destroy_free() function which
will destroy the AS and then free the memory it uses, all
in one RCU callback.

(CC to stable because the next commit needs this function.)

Cc: [email protected]
Signed-off-by: Peter Xu <[email protected]>
[PMM: Expanded commit message with motivation, tweaked comment]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
---

Reviewed-by: David Hildenbrand <[email protected]>

--
Cheers

David / dhildenb


Reply via email to