kernel/vm: Perform area ownership check before protection check.
This way we do not "leak" area protection status (not really a significant concern at the moment, but might as well while I was looking at this.)
This commit is contained in:
@@ -2918,9 +2918,6 @@ vm_set_area_protection(team_id team, area_id areaID, uint32 newProtection,
|
|||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (area->protection == newProtection)
|
|
||||||
return B_OK;
|
|
||||||
|
|
||||||
if (team != VMAddressSpace::KernelID()
|
if (team != VMAddressSpace::KernelID()
|
||||||
&& area->address_space->ID() != team) {
|
&& area->address_space->ID() != team) {
|
||||||
// unless you're the kernel, you are only allowed to set
|
// unless you're the kernel, you are only allowed to set
|
||||||
@@ -2928,6 +2925,9 @@ vm_set_area_protection(team_id team, area_id areaID, uint32 newProtection,
|
|||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (area->protection == newProtection)
|
||||||
|
return B_OK;
|
||||||
|
|
||||||
isWritable
|
isWritable
|
||||||
= (area->protection & (B_WRITE_AREA | B_KERNEL_WRITE_AREA)) != 0;
|
= (area->protection & (B_WRITE_AREA | B_KERNEL_WRITE_AREA)) != 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user