Skip to content

Commit d853329

Browse files
asahilinajannau
authored andcommitted
drm/asahi: file: Reject gem_bind past the end of the object
Signed-off-by: Asahi Lina <[email protected]>
1 parent 1bd79a7 commit d853329

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/gpu/drm/asahi/file.rs

+5
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)