XENIFACE_GNTTAB_CONTEXT associated with the request was incorrectly freed
by GnttabPermitForeignAccess() when a failure occured. The context is also
freed by the parent function, IoctlGnttabPermitForeignAccess(), which led
to a double-free and kernel heap corruption.
GnttabStopSharing() as the final step in the failure path takes care
of cleaning up the contents of the (possibly partially initialized) context.
Signed-off-by: Rafał Wojdyła <omeg@invisiblethingslab.com>
Reviewed-by: Owen Smith <owen.smith@cloud.com>
fail1:
Error("Fail1\n");
GnttabStopSharing(Fdo, Context, Page);
-
- if (Context != NULL) {
- RtlZeroMemory(Context, sizeof(*Context));
- __FreePoolWithTag(Context, XENIFACE_POOL_TAG);
- }
-
return Status;
}