diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 49e752b678..20aa0a53fc 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -2918,9 +2918,6 @@ vm_set_area_protection(team_id team, area_id areaID, uint32 newProtection, return B_NOT_ALLOWED; } - if (area->protection == newProtection) - return B_OK; - if (team != VMAddressSpace::KernelID() && area->address_space->ID() != team) { // 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; } + if (area->protection == newProtection) + return B_OK; + isWritable = (area->protection & (B_WRITE_AREA | B_KERNEL_WRITE_AREA)) != 0;