From 2aeb8dbadd69e2ec6191c8c17a76490081c2be44 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 8 May 2017 14:42:40 +0200 Subject: [PATCH] device: fix check in addrconf6_start() We check the return value of _get_stable_id(); when it is NULL priv->ndisc would stay NULL too and we would crash when dereferencing @error. Actually, _get_stable_id() can never return NULL, so replace the check with an assertion. (cherry picked from commit 8b73812062686472e4b082215872adc8f7d3ee9f) --- src/devices/nm-device.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4441068675..ebae9992c5 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -7418,16 +7418,15 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr) g_assert (s_ip6); stable_id = _get_stable_id (self, connection, &stable_type); - if (stable_id) { - priv->ndisc = nm_lndp_ndisc_new (nm_device_get_platform (self), - nm_device_get_ip_ifindex (self), - nm_device_get_ip_iface (self), - stable_type, - stable_id, - nm_setting_ip6_config_get_addr_gen_mode (s_ip6), - ndisc_node_type (self), - &error); - } + g_assert (stable_id); + priv->ndisc = nm_lndp_ndisc_new (nm_device_get_platform (self), + nm_device_get_ip_ifindex (self), + nm_device_get_ip_iface (self), + stable_type, + stable_id, + nm_setting_ip6_config_get_addr_gen_mode (s_ip6), + ndisc_node_type (self), + &error); if (!priv->ndisc) { _LOGE (LOGD_IP6, "addrconf6: failed to start neighbor discovery: %s", error->message); g_error_free (error);