Fix two crashes

policy: check device state before changing it for secondaries (rh #1055099)
team: fix crash in teamdctl (rh #1076469)
This commit is contained in:
Jiří Klimeš 2014-04-15 12:09:00 +02:00
parent bbca706eae
commit 3f6ed554c5
3 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From e7570b398c6a658732cdc5cc0566beaf2f23e6fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 15 Apr 2014 11:51:56 +0200
Subject: [PATCH] policy: check device state before changing it for
secondaries (rh #1055099)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We have to check the previous base device state in process_secondaries() when
making a state change. The device might got disconnected in the meantime and
thus the transition from DISCONNECTED to ACTIVATED or FAILED would have been
incorrect.
https://bugzilla.redhat.com/show_bug.cgi?id=1055099
https://bugzilla.redhat.com/show_bug.cgi?id=1055101
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-policy.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index f454d90..fa31d6c 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1087,7 +1087,8 @@ process_secondaries (NMPolicy *policy,
/* None secondary UUID remained -> remove the secondary data item */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
+ if (nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
return;
}
} else {
@@ -1098,8 +1099,10 @@ process_secondaries (NMPolicy *policy,
/* Secondary connection failed -> do not watch other connections */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
- NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
+ if ( nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES
+ || nm_device_get_state (item_device) == NM_DEVICE_STATE_ACTIVATED)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
+ NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
return;
}
}
--
1.7.11.7

View File

@ -0,0 +1,33 @@
From 6b6265ebebd7342a0d414bd1370e7af0e472d522 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 8 Nov 2013 15:34:55 -0600
Subject: [PATCH] team: fix possible crash by ensuring teamd context is
cleared
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
teamd_cleanup() might get called multiple times, and since the rest
of the function is safe against multi-calls, make priv->tdc safe
against being called again too.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device-team.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c
index 734cf4d..1fe7caf 100644
--- a/src/devices/nm-device-team.c
+++ b/src/devices/nm-device-team.c
@@ -270,6 +270,7 @@ teamd_cleanup (NMDevice *dev, gboolean device_state_failed)
if (priv->tdc) {
teamdctl_disconnect (priv->tdc);
teamdctl_free (priv->tdc);
+ priv->tdc = NULL;
}
#endif
--
1.7.11.7

View File

@ -42,7 +42,7 @@ Name: NetworkManager
Summary: Network connection manager and user applications
Epoch: 1
Version: 0.9.9.0
Release: 36%{snapshot}%{?dist}
Release: 37%{snapshot}%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -110,6 +110,8 @@ Patch56: 0056-rh1084556-pending-action-queued-state-lock.patch
Patch57: 0057-emit-property-changed-for-active-conn.patch
Patch58: 0058-rh1086132-NM-crash-fix-wifi-ap-utils.patch
Patch59: 0059-rh1056133-fix-modem-enable-crash.patch
Patch60: 0060-rh1055099-secondary-connections-state.patch
Patch61: 0061-rh1076469-fix-crash-teamdctl-cli-fini.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -334,6 +336,8 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
%patch57 -p1 -b .0057-emit-property-changed-for-active-conn.orig
%patch58 -p1 -b .0058-rh1086132-NM-crash-fix-wifi-ap-utils.orig
%patch59 -p1 -b .0059-rh1056133-fix-modem-enable-crash.orig
%patch60 -p1 -b .0060-rh1055099-secondary-connections-state.orig
%patch61 -p1 -b .0061-rh1076469-fix-crash-teamdctl-cli-fini.orig
%build
@ -558,6 +562,10 @@ fi
%endif
%changelog
* Tue Apr 15 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-37.git20131003
- policy: check device state before changing it for secondaries (rh #1055099)
- team: fix crash in teamdctl (rh #1076469)
* Mon Apr 14 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-36.git20131003
- mobile: fix crash (only move to NEED_AUTH during activation (rh #1056133) (rh #1058308)