arch: arc: fix the bug where buffer validate should be atomic
reported by #22290 and similar to #22275, the access to mpu regs in buffer validate should be atomic. Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This commit is contained in:
parent
8450d26b34
commit
d1fa27c42f
|
@ -656,7 +656,7 @@ int arc_core_mpu_get_max_domain_partition_regions(void)
|
|||
int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
|
||||
{
|
||||
int r_index;
|
||||
|
||||
int key = arch_irq_lock();
|
||||
|
||||
/*
|
||||
* For ARC MPU v3, overlapping is not supported.
|
||||
|
@ -667,13 +667,17 @@ int arc_core_mpu_buffer_validate(void *addr, size_t size, int write)
|
|||
/* match and the area is in one region */
|
||||
if (r_index >= 0 && r_index == _mpu_probe((u32_t)addr + (size - 1))) {
|
||||
if (_is_user_accessible_region(r_index, write)) {
|
||||
return 0;
|
||||
r_index = 0;
|
||||
} else {
|
||||
return -EPERM;
|
||||
r_index = -EPERM;
|
||||
}
|
||||
} else {
|
||||
r_index = -EPERM;
|
||||
}
|
||||
|
||||
return -EPERM;
|
||||
arch_irq_unlock(key);
|
||||
|
||||
return r_index;
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
|
|
Loading…
Reference in a new issue