When rte_hash_add_key_data() is called with an existing key, the old data pointer is silently overwritten. With RCU-protected readers still potentially accessing the old data, the application cannot safely free it since the old pointer is never returned.
This series provides two ways to address the problem: * Automatic: when RCU is configured with a free_key_data_func callback, rte_hash_add_key_data() now automatically defers freeing the old data on overwrite. No caller changes are needed. * Explicit: a new rte_hash_replace_key_data() API returns the previous data pointer via an output parameter, giving the caller full control over the old pointer's lifecycle. No automatic deferred free is performed in that case. Robin Jarry (2): hash: free replaced data on overwrite when RCU is configured hash: add replace API returning old data on overwrite app/test/test_hash.c | 214 +++++++++++++++++++++++++ doc/guides/rel_notes/release_26_03.rst | 12 ++ lib/hash/rte_cuckoo_hash.c | 146 +++++++++++++---- lib/hash/rte_hash.h | 75 ++++++++- 4 files changed, 417 insertions(+), 30 deletions(-) -- 2.53.0

