mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-26 15:30:27 +01:00
device: check ifindex before changing ethernet link settings
During the call to deactivate(), the device can already have lost the
ifindex. Add a check for that to prevent assertion:
((src/platform/nm-platform.c:3306)): assertion 'g_return_val_if_fail(ifindex > 0, FALSE)' failed
0 g_logv (libglib-2.0.so.0 + 0x5bf67)
1 g_log (libglib-2.0.so.0 + 0x5c223)
2 _nm_g_return_if_fail_warning.lto_priv.0 (NetworkManager + 0x4c69f)
3 nm_platform_ethtool_set_link_settings (NetworkManager + 0x183418)
4 deactivate.lto_priv.1 (NetworkManager + 0x27dfd1)
5 nm_device_cleanup (NetworkManager + 0x25b047)
6 _set_state_full (NetworkManager + 0x24f4d8)
7 nm_device_unrealize (NetworkManager + 0x259e63)
8 _platform_link_cb_idle (NetworkManager + 0x27097f)
9 g_idle_dispatch (libglib-2.0.so.0 + 0x5305b)
10 g_main_context_dispatch (libglib-2.0.so.0 + 0x53f8f)
11 g_main_context_iterate.constprop.0 (libglib-2.0.so.0 + 0xa74d8)
12 g_main_loop_run (libglib-2.0.so.0 + 0x53673)
13 main (NetworkManager + 0x4bdba)
14 __libc_start_main (libc.so.6 + 0x27b75)
15 _start (NetworkManager + 0x4c3ee)
https://bugzilla.redhat.com/show_bug.cgi?id=1923062
(cherry picked from commit 2757da7eac)
This commit is contained in:
parent
aa2bc9e6e4
commit
daad4e2fee
1 changed files with 4 additions and 2 deletions
|
|
@ -1525,6 +1525,7 @@ deactivate(NMDevice *device)
|
|||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE(self);
|
||||
NMSettingDcb * s_dcb;
|
||||
GError * error = NULL;
|
||||
int ifindex;
|
||||
|
||||
nm_clear_g_source(&priv->pppoe_wait_id);
|
||||
nm_clear_g_signal_handler(self, &priv->carrier_id);
|
||||
|
|
@ -1553,7 +1554,8 @@ deactivate(NMDevice *device)
|
|||
if (nm_device_get_applied_setting(device, NM_TYPE_SETTING_PPPOE))
|
||||
priv->last_pppoe_time = nm_utils_get_monotonic_timestamp_sec();
|
||||
|
||||
if (priv->ethtool_prev_set) {
|
||||
ifindex = nm_device_get_ifindex(device);
|
||||
if (ifindex > 0 && priv->ethtool_prev_set) {
|
||||
priv->ethtool_prev_set = FALSE;
|
||||
|
||||
_LOGD(LOGD_DEVICE,
|
||||
|
|
@ -1562,7 +1564,7 @@ deactivate(NMDevice *device)
|
|||
priv->ethtool_prev_speed,
|
||||
nm_platform_link_duplex_type_to_string(priv->ethtool_prev_duplex));
|
||||
if (!nm_platform_ethtool_set_link_settings(nm_device_get_platform(device),
|
||||
nm_device_get_ifindex(device),
|
||||
ifindex,
|
||||
priv->ethtool_prev_autoneg,
|
||||
priv->ethtool_prev_speed,
|
||||
priv->ethtool_prev_duplex)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue