mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
fix(gsp_route): remove accidental MAP physical-backing check from UNMAP arm
This commit is contained in:
@ -3097,29 +3097,10 @@ fn exec_mm_op(
|
||||
if op.size == 0 || (op.virt_off & 0xfff) != 0 || (op.size & 0xfff) != 0 {
|
||||
return Err(ST_INVALID_ARGUMENT);
|
||||
}
|
||||
// Validate physical backing completely before writing any PTEs so mapper MAP
|
||||
// requests cannot silently truncate past the physical object.
|
||||
let resolved_phys = node.classes.resolve_memory_handle(mm.client, op.h_phys);
|
||||
let Some(phys_mem) = node.classes.memory.find(mm.client, resolved_phys) else {
|
||||
return Err(ST_INVALID_ARGUMENT);
|
||||
};
|
||||
if op.phys_off > phys_mem.size || op.size > phys_mem.size - op.phys_off {
|
||||
return Err(ST_INVALID_ARGUMENT);
|
||||
}
|
||||
// `map_dma_ga10x_no_flush` rounds `(phys_off & 0xfff) + size` up to whole 4K pages;
|
||||
// bound that full rounded span against the virtual allocation before writing PTEs.
|
||||
let phys_page_off = op.phys_off & 0xfff;
|
||||
let Some(mapped_span) = phys_page_off
|
||||
.checked_add(op.size)
|
||||
.map(|s| s.div_ceil(0x1000))
|
||||
.and_then(|pages| pages.checked_mul(0x1000))
|
||||
else {
|
||||
return Err(ST_INVALID_ARGUMENT);
|
||||
};
|
||||
let Some(va) = ext.base.checked_add(op.virt_off) else {
|
||||
return Err(ST_INVALID_ARGUMENT);
|
||||
};
|
||||
let Some(end_incl) = va.checked_add(mapped_span - 1) else {
|
||||
let Some(end_incl) = va.checked_add(op.size - 1) else {
|
||||
return Err(ST_INVALID_ARGUMENT);
|
||||
};
|
||||
if va < ext.base || end_incl > ext.last {
|
||||
|
||||
Reference in New Issue
Block a user