init: prevent double session-upgrade forwarding

Fixes #5367
This commit is contained in:
Norman Feske 2024-10-21 15:19:41 +02:00 committed by Christian Helmuth
parent 986bec20a9
commit e1be17b56d

View File

@ -316,11 +316,12 @@ void Sandbox::Server::_handle_upgrade_session_request(Xml_node request,
{
_client_id_space.apply<Session_state>(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();