Message ID | 20241021225738.3057955-1-ram.subramanian@getcruise.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 6bd975925b22ca6dca27b6eeac652ddc9f1165a1 |
Headers | show |
Series | gsupplicant: fix ASAN issue | expand |
Hello: This patch was applied to connman.git (master) by Marcel Holtmann <marcel@holtmann.org>: On Mon, 21 Oct 2024 15:57:38 -0700 you wrote: > The problem is `bss` and `bss->path` can be used after being freed, in > this line: > > g_hash_table_replace(bss_mapping, bss->path, interface); > > This is because the following call: > > [...] Here is the summary with links: - gsupplicant: fix ASAN issue https://git.kernel.org/pub/scm/network/connman/connman.git/?id=6bd975925b22 You are awesome, thank you!
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 1b92ec44..f3be9e7b 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -1708,7 +1708,7 @@ static int add_or_replace_bss_to_network(struct g_supplicant_bss *bss) network->config_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(interface->network_table, + g_hash_table_insert(interface->network_table, network->group, network); callback_network_added(network); @@ -1735,9 +1735,8 @@ done: } g_hash_table_replace(interface->bss_mapping, bss->path, network); - g_hash_table_replace(network->bss_table, bss->path, bss); - g_hash_table_replace(bss_mapping, bss->path, interface); + g_hash_table_replace(network->bss_table, bss->path, bss); return 0; }