Skip to content

Commit 6cd0b59

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: file: Reject gem_bind past the end of the object
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent eda45fa commit 6cd0b59

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/gpu/drm/asahi/file.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,11 @@ impl File {
584584
let end = data.addr.checked_add(data.range).ok_or(EINVAL)?;
585585
let range = start..end;
586586

587+
let end_off = data.offset.checked_add(data.range).ok_or(EINVAL)?;
588+
if end_off as usize > bo.size() {
589+
return Err(EINVAL);
590+
}
591+
587592
if !VM_USER_RANGE.is_superset(range.clone()) {
588593
cls_pr_debug!(
589594
Errors,

0 commit comments

Comments
 (0)