From 24d71b5278d4765dcda55cfb55e186413ba33657 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 20 Feb 2020 14:44:58 +0100 Subject: [PATCH] ovs: fail port enslavement when the bridge device is not found Fail the enslavement of the ovs port if the bridge device is not found, instead of generating assertions and potentially crash later. https://bugzilla.redhat.com/show_bug.cgi?id=1797696 Fixes: 101e65d2bb19 ('ovs: allow changing mac address of bridges and interfaces') (cherry picked from commit c5c49995b10baf043fa57a96c9d8ddf2e99267b4) (cherry picked from commit 7494a2e37ab0114d1d3ef93b0dbe47005d3f8741) (cherry picked from commit bb7f729eca246e289a9a62444f0f77345fe765f2) --- src/devices/ovs/nm-device-ovs-port.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/devices/ovs/nm-device-ovs-port.c b/src/devices/ovs/nm-device-ovs-port.c index 28096f4d1d..0a05747bf8 100644 --- a/src/devices/ovs/nm-device-ovs-port.c +++ b/src/devices/ovs/nm-device-ovs-port.c @@ -117,6 +117,11 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection, gboo } bridge_device = nm_active_connection_get_device (ac_bridge); + if (!bridge_device) { + _LOGW (LOGD_DEVICE, "can't enslave %s: bridge device not found", + nm_device_get_iface (slave)); + return FALSE; + } nm_ovsdb_add_interface (nm_ovsdb_get (), nm_active_connection_get_applied_connection (ac_bridge),