From 32b7a91c19aa73c3b25262a67ed2a66b343d38f2 Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Mon, 5 Aug 2024 13:14:39 +0200 Subject: [PATCH] vfs_tap: prevent unnoticed link state changes Swap order of link_state() and link_state_sigh() calls in order to not miss any link state changes. Fixes #5316 --- repos/os/src/lib/vfs/tap/nic_file_system.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repos/os/src/lib/vfs/tap/nic_file_system.h b/repos/os/src/lib/vfs/tap/nic_file_system.h index 7e657f375c..1f6c20e164 100644 --- a/repos/os/src/lib/vfs/tap/nic_file_system.h +++ b/repos/os/src/lib/vfs/tap/nic_file_system.h @@ -60,7 +60,7 @@ class Vfs::Nic_file_system::Nic_vfs_handle : public Single_vfs_handle Vfs::Env::User &_vfs_user; Nic::Packet_allocator _pkt_alloc; Nic::Connection _nic; - bool _link_state; + bool _link_state { false }; bool _notifying = false; bool _blocked = false; @@ -111,10 +111,10 @@ class Vfs::Nic_file_system::Nic_vfs_handle : public Single_vfs_handle _env(env), _vfs_user(vfs_user), _pkt_alloc(&alloc), - _nic(_env, &_pkt_alloc, BUF_SIZE, BUF_SIZE, label.string()), - _link_state(_nic.link_state()) + _nic(_env, &_pkt_alloc, BUF_SIZE, BUF_SIZE, label.string()) { _nic.link_state_sigh(_link_state_handler); + _link_state = _nic.link_state(); _nic.tx_channel()->sigh_ack_avail (_ack_avail_handler); _nic.rx_channel()->sigh_ready_to_ack (_read_avail_handler); _nic.rx_channel()->sigh_packet_avail (_read_avail_handler);