From ac4e61205dcf365396ca44941ad055c7bd88c631 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Mon, 4 Oct 2021 15:19:44 -0500 Subject: interface: handle error during admin-up correctly Type: fix In vnet_sw_interface_set_flags_helper(), the variable old_flags is set to the original value of vnet_sw_interface_t.flags for an interface. If an error occurs during the process of bringing an interface up, old_flags is used to restore the original value. Before the dev class or hw class admin_up_down_function can be called, but after modifying vnet_sw_interface_t.flags to it's new value, old_flags is set to the value of vnet_sw_interface_t.flags a second time. This discards the original flags that were being preserved. As a result, if an interface is being brought up and the dev class or hw class function fails, at the end VPP believes that interface is up. This can cause a crash if packets are routed through the interface and some RX/TX initialization was not completed because of the error while bringing the interface up. Change-Id: Ica6b6bac13c24e88c4136bf084cd392e6217e7d9 Signed-off-by: Matthew Smith --- src/vnet/interface.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/vnet/interface.c b/src/vnet/interface.c index ad6d9ccfdb8..ab12da563a5 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -462,9 +462,6 @@ vnet_sw_interface_set_flags_helper (vnet_main_t * vnm, u32 sw_if_index, goto done; } - /* save the si admin up flag */ - old_flags = si->flags; - /* update si admin up flag in advance if we are going admin down */ if (!(flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)) si->flags &= ~VNET_SW_INTERFACE_FLAG_ADMIN_UP; -- cgit 1.2.3-korg