mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
virtio: video: reject resources with more than one entry
The crosvm video device cannot currently work with resources that have more than one memory/object entry. Enforce this rule at the command level. BUG=b:161774071 BUG=b:169295147 TEST=Android Youtube plays properly on Hatch. Cq-Depend: chromium:3247491 Cq-Depend: chromium:3247492 Change-Id: Ibfe2e420b4a77062cca940c5e97e7053aa4b76a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026345 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
parent
5ebe30d0e5
commit
4ceec18783
1 changed files with 7 additions and 0 deletions
|
@ -160,6 +160,7 @@ impl<'a> VideoCmd {
|
|||
planes_layout,
|
||||
num_planes,
|
||||
plane_offsets,
|
||||
num_entries,
|
||||
..
|
||||
} = r.read_obj()?;
|
||||
|
||||
|
@ -181,6 +182,12 @@ impl<'a> VideoCmd {
|
|||
);
|
||||
return Err(InvalidArgument);
|
||||
}
|
||||
// We only support single-entry objects for now.
|
||||
if num_planes != 1 || num_entries[0] != 1 {
|
||||
error!("the number of entries must be equal to 1");
|
||||
return Err(InvalidArgument);
|
||||
}
|
||||
|
||||
let plane_offsets = plane_offsets[0..num_planes as usize]
|
||||
.iter()
|
||||
.map(|x| Into::<u32>::into(*x))
|
||||
|
|
Loading…
Reference in a new issue