NetworkManager/src/settings
Jiří Klimeš 91a95dd916 agents: fix crash in nm_secret_agent_cancel_secrets() (rh #922855)
When request for getting secrets is being freed in request_free(),
cancel_callback is get_cancel_cb(). It uses parent->current as a secret agent
object. However, this object can be already freed and thus there is a problem
getting priv in nm_secret_agent_cancel_secrets:

g_return_if_fail (self != NULL);
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
(gdb) p self
$66 = (NMSecretAgent *) 0x7fae9afd42e0
(gdb) p *self
$67 = {parent = {g_type_instance = {g_class = 0x0}, ref_count = 0, qdata = 0x0}}

 #0  nm_secret_agent_cancel_secrets (self=0x7fae9afd42e0, call=0x1) at settings/nm-secret-agent.c:325
 #1  0x00007fae9a774882 in request_free (req=0x7fae9afc48f0) at settings/nm-agent-manager.c:496
 #2  0x00007fae967b251a in g_hash_table_remove_internal (hash_table=0x7fae9aefdf00, key=0x2, notify=1) at ghash.c:1276
 #3  0x00007fae9a72b340 in dispose (object=0x7fae9af77200) at nm-activation-request.c:446
 #4  0x00007fae96cbeee8 in g_object_unref (_object=0x7fae9af77200) at gobject.c:3160
 #5  0x00007fae9a73d87c in _active_connection_cleanup (user_data=<optimized out>) at nm-manager.c:359
 #6  0x00007fae967c32a6 in g_main_dispatch (context=0x7fae9aedb180) at gmain.c:3066
 #7  g_main_context_dispatch (context=context@entry=0x7fae9aedb180) at gmain.c:3642
 #8  0x00007fae967c3628 in g_main_context_iterate (context=0x7fae9aedb180, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
 #9  0x00007fae967c3a3a in g_main_loop_run (loop=0x7fae9aedb860) at gmain.c:3907

So we need to ref() 'agent' when adding it to pending list, so that the object
is not freed if the secret agent unregisters and is removed.

Test case:
1. run NM and nm-applet
2. activate a Wi-Fi network
3. nm-applet will ask for a password; ignore the popup window and kill nm-applet
4. start nm-applet again
5. click the same Wi-Fi network in nm-applet
6. NM will experience problems in nm_secret_agent_cancel_secrets() or crashes
(the procedure may not be 100%, but reproduces most of the time)

https://bugzilla.redhat.com/show_bug.cgi?id=922855
2013-11-26 14:43:11 +01:00
..
plugins trivial: ifcfg-rh: remove unused code/variables 2013-11-18 16:38:07 +01:00
tests build: switch from $(INCLUDES) to $(AM_CPPFLAGS) to make automake happy 2013-08-22 11:49:16 -04:00
nm-agent-manager.c agents: fix crash in nm_secret_agent_cancel_secrets() (rh #922855) 2013-11-26 14:43:11 +01:00
nm-agent-manager.h vpn: handle interactive plugin secrets requests 2013-07-31 08:16:40 -05:00
nm-inotify-helper.c libnm-glib, core: use g_cclosure_marshal_generic 2013-05-08 14:59:29 -04:00
nm-inotify-helper.h settings: add note about killing inotify helper (bgo #532815) 2013-01-11 13:02:12 -06:00
nm-secret-agent.c agents: use NMAuthSubject 2013-10-31 14:15:07 -05:00
nm-secret-agent.h agents: use NMAuthSubject 2013-10-31 14:15:07 -05:00
nm-settings-connection.c settings: convert NMDefaultWiredConnection into a plain NMSettingsConnection (rh #1029464) (bgo #712188) 2013-11-13 11:50:12 -06:00
nm-settings-connection.h settings: convert NMDefaultWiredConnection into a plain NMSettingsConnection (rh #1029464) (bgo #712188) 2013-11-13 11:50:12 -06:00
nm-settings-error.c Use glib-mkenums to generate enum types 2012-02-15 11:42:15 -05:00
nm-settings-error.h settings: validate hostnames from D-Bus (bgo #711179) 2013-11-07 09:56:14 -06:00
nm-settings-utils.c settings: fix getting default wired connection name with no connections 2011-03-30 12:02:50 -05:00
nm-settings-utils.h settings: fix getting default wired connection name with no connections 2011-03-30 12:02:50 -05:00
nm-settings.c core: add o.fd.NM.Settings.LoadConnections 2013-11-15 13:30:13 -05:00
nm-settings.h core: allow default wired connections to stay up when quitting 2013-11-14 11:34:07 -06:00
nm-system-config-interface.c settings: fix return value in nm_system_config_interface_load_connection() 2013-11-18 09:13:50 +01:00
nm-system-config-interface.h core: add o.fd.NM.Settings.LoadConnections 2013-11-15 13:30:13 -05:00