iommu: retype with the correct object size
@@ -261,21 +261,29 @@ static void retype_request(struct iommu_binding *ib, struct capref src,
err = invoke_frame_identify(src, &id);
if (err_is_fail(err)) {
+ err = err_push(err, LIB_ERR_CAP_INVOKE);
goto send_reply;
}
/* we should be the only one that has it */
err = cap_revoke(src);
if (err_is_fail(err)) {
+ err = err_push(err, LIB_ERR_CAP_DELETE_FAIL);
goto send_reply;
}
+
+ /* allocate slot to store the new cap */
err = slot_alloc(&retcap);
if (err_is_fail(err)) {
+ err = err_push(err, LIB_ERR_SLOT_ALLOC);
+ retcap = src;
goto send_reply;
}
- err = cap_retype(retcap, src, 0, objtype, 11, 1);
+ /* retype it to a page table */
+ err = cap_retype(retcap, src, 0, objtype, id.bytes, 1);
if (err_is_fail(err)) {
+ err = err_push(err, LIB_ERR_CAP_RETYPE);
slot_free(retcap);
retcap = src;
goto send_reply;
