Skip to content

Commit bd80a6c

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 c66a787 commit bd80a6c

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
@@ -572,6 +572,11 @@ impl File {
572572
let end = data.addr.checked_add(data.range).ok_or(EINVAL)?;
573573
let range = start..end;
574574

575+
let end_off = data.offset.checked_add(data.range).ok_or(EINVAL)?;
576+
if end_off as usize > bo.size() {
577+
return Err(EINVAL);
578+
}
579+
575580
if !VM_USER_RANGE.is_superset(range.clone()) {
576581
cls_pr_debug!(
577582
Errors,

0 commit comments

Comments
 (0)