base: avoid Pd_session::Invalid_session condition

By adding a sanity check for the validity of the PD session targeted by
a transfer_quota operation, the corner case of an incomplete PD session
of a child can no longer trigger an 'Invalid_session' exception.
This commit is contained in:
Norman Feske 2018-07-12 16:34:55 +02:00 committed by Christian Helmuth
parent 17e6db431e
commit ac0562ec18
1 changed files with 7 additions and 2 deletions

View File

@ -473,8 +473,13 @@ class Genode::Child : protected Rpc_object<Parent>,
Ram_quota const ram_quota { CONNECTION::RAM_QUOTA };
Cap_quota const cap_quota { CONNECTION::CAP_QUOTA };
_child._policy.ref_pd().transfer_quota(cap(ram_quota), ram_quota);
_child._policy.ref_pd().transfer_quota(cap(cap_quota), cap_quota);
if (cap(ram_quota).valid())
_child._policy.ref_pd().transfer_quota(cap(ram_quota), ram_quota);
if (cap(cap_quota).valid())
_child._policy.ref_pd().transfer_quota(cap(cap_quota), cap_quota);
_first_request = false;
}