diff mbox series

P2P: Notify dbus about removing of stale group id

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

Commit Message

Amit Khatri Jan. 3, 2019, 3:47 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

Jouni Malinen Jan. 4, 2019, 12:03 p.m. UTC | #1
On Thu, Jan 03, 2019 at 09:17:26PM +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

Thanks, applied with some cleanup.
diff mbox series

Patch

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 3049894..a85853e 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(wpa_s,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;