diff mbox series

P2P: Notify dbus about removing of stale group id

Message ID 1546529300-7475-1-git-send-email-amit7861234@gmail.com
State Superseded
Headers show
Series P2P: Notify dbus about removing of stale group id | expand

Commit Message

Amit Khatri Jan. 3, 2019, 3:28 p.m. UTC
During PD request processing wpa_supplicant remove stale group.
but not notifying to dbus for persistent group to unregister object.
Some time it cause to crash in wpa_config_get_all() function.
because during persistent group register
"wpas_dbus_register_persistent_group" -> "wpa_dbus_register_object_per_iface"
if DBUS_ERROR_OBJECT_PATH_IN_USE error occur; this indicate dbus
knows object name; It should not happen;
e.g.
register a object on wpa_supplicant startup
/fi/w1/wpa_supplicant1/PersistentGroups/3 but some how 3 numbered id
removed during PD request processing of stale group. which tends to
DBUS_ERROR_OBJECT_PATH_IN_USE error.
and you execute GetAll properties of PersistentGroups/3 could crash wpa_supplicant

Signed-off-by: Amit Khatri <amit7861234@gmail.com>
---
 wpa_supplicant/p2p_supplicant.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Dan Williams Jan. 3, 2019, 8:34 p.m. UTC | #1
On Thu, 2019-01-03 at 20:58 +0530, Amit Khatri wrote:
> During PD request processing wpa_supplicant remove stale group.
> but not notifying to dbus for persistent group to unregister object.
> Some time it cause to crash in wpa_config_get_all() function.
> because during persistent group register
> "wpas_dbus_register_persistent_group" ->
> "wpa_dbus_register_object_per_iface"
> if DBUS_ERROR_OBJECT_PATH_IN_USE error occur; this indicate dbus
> knows object name; It should not happen;
> e.g.
> register a object on wpa_supplicant startup
> /fi/w1/wpa_supplicant1/PersistentGroups/3 but some how 3 numbered id
> removed during PD request processing of stale group. which tends to
> DBUS_ERROR_OBJECT_PATH_IN_USE error.
> and you execute GetAll properties of PersistentGroups/3 could crash
> wpa_supplicant
> 
> Signed-off-by: Amit Khatri <amit7861234@gmail.com>
> ---
>  wpa_supplicant/p2p_supplicant.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/wpa_supplicant/p2p_supplicant.c
> b/wpa_supplicant/p2p_supplicant.c
> index 3049894..c1d15a2 100644
> --- a/wpa_supplicant/p2p_supplicant.c
> +++ b/wpa_supplicant/p2p_supplicant.c
> @@ -3918,6 +3918,8 @@ static int wpas_remove_stale_groups(void *ctx,
> const u8 *peer, const u8 *go,
>  
>  		/* Remove stale persistent group */
>  		if (s->mode != WPAS_MODE_P2P_GO || s->num_p2p_clients
> <= 1) {
> +			wpa_dbg(MSG_ERROR,"Removing stale group
> ssid  id = %d",s->id);
> +			wpas_notify_persistent_group_removed(wpa_s,s);

Small nit, but wpa_supplicant code style uses a space after the comma
between arguments, eg:

wpas_notify_persistent_group_removed(wpa_s, s);

same for the wpa_dbg() just above.

Thanks,
Dan

>  			wpa_config_remove_network(wpa_s->conf, s->id);
>  			save_config = 1;
>  			continue;
diff mbox series

Patch

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 3049894..c1d15a2 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3918,6 +3918,8 @@  static int wpas_remove_stale_groups(void *ctx, const u8 *peer, const u8 *go,
 
 		/* Remove stale persistent group */
 		if (s->mode != WPAS_MODE_P2P_GO || s->num_p2p_clients <= 1) {
+			wpa_dbg(MSG_ERROR,"Removing stale group ssid  id = %d",s->id);
+			wpas_notify_persistent_group_removed(wpa_s,s);
 			wpa_config_remove_network(wpa_s->conf, s->id);
 			save_config = 1;
 			continue;