From 919c8489132c079c964c518ead42fda86823510f Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Fri, 17 Mar 2017 23:30:43 +0100
Subject: [PATCH] manager: ensure proper disposal of unrealized devices
When remove_device() is called on an already unrealized device, we
should release it from master if necessary and clear its IP
configurations to avoid leaks.
https://bugzilla.redhat.com/show_bug.cgi?id=1433303
(cherry picked from commit 2e0c3d1dacfa06fad0062d272fc77ecc34ba4576)
(cherry picked from commit 427a3e5cff1bf852c17ef2b359676d037bd58f67)
(cherry picked from commit f0eb192d8c8fcb64b49476edf79f8769cfa225a7)
---
src/nm-manager.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index caf0a0e..1e796a8 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -990,7 +990,12 @@ remove_device (NMManager *self,
g_signal_emit (self, signals[DEVICE_REMOVED], 0, device);
_notify (self, PROP_DEVICES);
+ } else {
+ /* unrealize() does not release a slave device from master and
+ * clear IP configurations, do it here */
+ nm_device_removed (device, TRUE);
}
+
g_signal_emit (self, signals[INTERNAL_DEVICE_REMOVED], 0, device);
_notify (self, PROP_ALL_DEVICES);
--
2.7.4