Commit 76c34d48 authored by Jiří Klimeš's avatar Jiří Klimeš

core,settings: do not call functions with connection==NULL (rh #1008151)

check 'req' and 'connection' variables. Apparently, they can be NULL
on some circumstances.

NetworkManager[2830]: <info> (p6p1): device state change: secondaries -> disconnected (reason 'connection-removed') [90 30 38]
NetworkManager[2830]: <info> (p6p1): deactivating device (reason 'connection-removed') [38]
kernel: [ 2623.609111] NetworkManager[2830]: segfault at 50 ip 00007f1a309bf6a1 sp 00007fffc59e67e0 error 6 in NetworkManager[7f1a30915000+104000]
NetworkManager[2830]: (nm-device.c:5043):nm_device_state_changed: runtime check failed: (in_state_changed == FALSE)
NetworkManager[2830]: <info> (p6p1): device state change: disconnected -> failed (reason 'secondary-connection-failed') [30 120 54]
NetworkManager[2830]: nm_act_request_get_connection: assertion `NM_IS_ACT_REQUEST (req)' failed
NetworkManager[2830]: nm_connection_get_id: assertion `connection != NULL' failed
NetworkManager[2830]: <warn> Activation (p6p1) failed for connection '(null)'
NetworkManager[2830]: nm_settings_connection_get_timestamp: assertion `connection != NULL' failed
abrt[2882]: Saved core dump of pid 2830 (/usr/sbin/NetworkManager) to /var/tmp/abrt/ccpp-2013-09-15-11:38:39-2830 (18952192 bytes)
systemd[1]: NetworkManager.service: main process exited, code=dumped, status=11/SEGV
systemd[1]: Unit NetworkManager.service entered failed state.
parent 19b7fe5c
......@@ -6013,11 +6013,11 @@ nm_device_state_changed (NMDevice *device,
nm_dispatcher_call (DISPATCHER_ACTION_UP, nm_act_request_get_connection (req), device, NULL, NULL);
connection = nm_act_request_get_connection (req);
connection = nm_device_get_connection (device);
nm_log_warn (LOGD_DEVICE | LOGD_WIFI,
"Activation (%s) failed for connection '%s'",
nm_device_get_iface (device),
nm_connection_get_id (connection));
connection ? nm_connection_get_id (connection) : "<unknown>");
/* Notify any slaves of the unexpected failure */
nm_device_master_release_slaves (device, TRUE);
......@@ -6027,7 +6027,7 @@ nm_device_state_changed (NMDevice *device,
* failed (zero timestamp), connections that succeeded (non-zero timestamp),
* and those we haven't tried yet (no timestamp).
if (!nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (connection), NULL)) {
if (connection && !nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (connection), NULL)) {
nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (connection),
(guint64) 0,
......@@ -1563,7 +1563,7 @@ gboolean
nm_settings_connection_get_timestamp (NMSettingsConnection *connection,
guint64 *out_timestamp)
g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), 0);
g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), FALSE);
if (out_timestamp)
*out_timestamp = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->timestamp;
......@@ -1591,6 +1591,8 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *connection,
gsize len;
GError *error = NULL;
g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
/* Update timestamp in private storage */
priv->timestamp = timestamp;
priv->timestamp_set = TRUE;
......@@ -1640,6 +1642,8 @@ nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection
GError *err = NULL;
char *tmp_str;
g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
/* Get timestamp from database file */
timestamps_file = g_key_file_new ();
g_key_file_load_from_file (timestamps_file, SETTINGS_TIMESTAMPS_FILE, G_KEY_FILE_KEEP_COMMENTS, NULL);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment