[NTOSKRNL]: CORE-6698 #resolve #time 5m #comment Add correct error handling during session space view mapping.

svn path=/trunk/; revision=57475
This commit is contained in:
Alex Ionescu 2012-10-04 06:19:42 +00:00
parent 2552915ae3
commit ecf46ebc82

View file

@ -1021,8 +1021,10 @@ MiMapViewInSystemSpace(IN PVOID Section,
/* Check if the caller wanted a larger section than the view */ /* Check if the caller wanted a larger section than the view */
if (*ViewSize > SectionSize) if (*ViewSize > SectionSize)
{ {
/* We should probably fail. FIXME TODO */ /* Fail */
ASSERT(FALSE); DPRINT1("View is too large\n");
MiDereferenceControlArea(ControlArea);
return STATUS_INVALID_VIEW_SIZE;
} }
/* Get the number of 64K buckets required for this mapping */ /* Get the number of 64K buckets required for this mapping */
@ -1032,14 +1034,22 @@ MiMapViewInSystemSpace(IN PVOID Section,
/* Check if the view is more than 4GB large */ /* Check if the view is more than 4GB large */
if (Buckets >= MI_SYSTEM_VIEW_BUCKET_SIZE) if (Buckets >= MI_SYSTEM_VIEW_BUCKET_SIZE)
{ {
/* We should probably fail */ /* Fail */
ASSERT(FALSE); DPRINT1("View is too large\n");
MiDereferenceControlArea(ControlArea);
return STATUS_INVALID_VIEW_SIZE;
} }
/* Insert this view into system space and get a base address for it */ /* Insert this view into system space and get a base address for it */
Base = MiInsertInSystemSpace(Session, Buckets, ControlArea); Base = MiInsertInSystemSpace(Session, Buckets, ControlArea);
ASSERT(Base); if (!Base)
{
/* Fail */
DPRINT1("Out of system space\n");
MiDereferenceControlArea(ControlArea);
return STATUS_NO_MEMORY;
}
/* What's the underlying session? */ /* What's the underlying session? */
if (Session == &MmSession) if (Session == &MmSession)
{ {