[PATCH] P2P: Disconnect P2P group on supplicant deinit
Jouni Malinen
j
Sat Mar 31 11:29:46 PDT 2012
On Thu, Mar 22, 2012 at 09:17:36AM -0700, nirav shah wrote:
> When a supplicant is deinited and shutting, adding code to disconnect
> from p2p_group. Found root causing the memory leak on variable
> dbus_groupobj_path on exiting supplicant.
> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> @@ -2570,6 +2570,18 @@ next_driver:
> static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s,
> int notify, int terminate)
> {
> +
> +#ifdef CONFIG_P2P
> + if (wpa_s && wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
> + /* This is a p2p interface */
> + wpa_printf(MSG_DEBUG, "P2P: Disconnecting the P2P group %s",
> + wpa_s->dbus_groupobj_path);
This breaks non-D-Bus builds..
> + /* Disconnect from the p2p group if any */
> + wpas_p2p_disconnect(wpa_s);
And this could potentially free the wpa_s structure which looks
suspicious when the following statement here dereferences the pointer:
> if (wpa_s->drv_priv) {
This will need to be done differently. What parts of
wpas_p2p_group_delete() are needed to avoid the memory leak? Just the
call to wpas_notify_p2p_group_removed() to get
wpas_dbus_unregister_p2p_group() called to free
wpa_s->dbus_groupobj_path?
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list