From e1be17b56d75f3b94699fefaf489e7686ac57bab Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 21 Oct 2024 15:19:41 +0200 Subject: [PATCH] init: prevent double session-upgrade forwarding Fixes #5367 --- repos/os/src/lib/sandbox/server.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/repos/os/src/lib/sandbox/server.cc b/repos/os/src/lib/sandbox/server.cc index c8e7a36136..c557d237be 100644 --- a/repos/os/src/lib/sandbox/server.cc +++ b/repos/os/src/lib/sandbox/server.cc @@ -316,11 +316,12 @@ void Sandbox::Server::_handle_upgrade_session_request(Xml_node request, { _client_id_space.apply(id, [&] (Session_state &session) { + if (session.phase == Session_state::UPGRADE_REQUESTED) + return; + Ram_quota const ram_quota { request.attribute_value("ram_quota", 0UL) }; Cap_quota const cap_quota { request.attribute_value("cap_quota", 0UL) }; - session.phase = Session_state::UPGRADE_REQUESTED; - try { Ram_transfer::Remote_account env_ram_account(_env.pd(), _env.pd_session_cap()); Cap_transfer::Remote_account env_cap_account(_env.pd(), _env.pd_session_cap()); @@ -338,6 +339,7 @@ void Sandbox::Server::_handle_upgrade_session_request(Xml_node request, return; } + session.phase = Session_state::UPGRADE_REQUESTED; session.increase_donated_quota(ram_quota, cap_quota); session.service().initiate_request(session); session.service().wakeup();