summaryrefslogtreecommitdiff
path: root/offload
diff options
context:
space:
mode:
author Martin Yan <mingyiyan@google.com> 2025-03-04 02:23:40 +0000
committer Martin Yan <mingyiyan@google.com> 2025-03-04 02:25:04 +0000
commitdb2b2881f19d4143b6c928f4329e1dc6877844a9 (patch)
treed878a1183aedfa9f05427856a14c1d3d493bc858 /offload
parent7481ab0ba08e1d85d9a5767279321b9d4671a499 (diff)
LE Audio Software Offload: Fix panic_const_rem_by_zero crash.
Bug: 375486605 Bug: 396350294 Flag: EXEMPT, enabled by vendor Test: mmm . Change-Id: I48d1afad1212784846df3deef53a7333880e6645
Diffstat (limited to 'offload')
-rw-r--r--offload/leaudio/hci/proxy.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/offload/leaudio/hci/proxy.rs b/offload/leaudio/hci/proxy.rs
index 79e45f06e1..604bde356d 100644
--- a/offload/leaudio/hci/proxy.rs
+++ b/offload/leaudio/hci/proxy.rs
@@ -16,8 +16,7 @@ use bluetooth_offload_hci as hci;
use crate::arbiter::Arbiter;
use crate::service::{Service, StreamConfiguration};
-use hci::{Command, Event, EventToBytes, IsoData, ReturnParameters, Status};
-use hci::{Module, ModuleBuilder};
+use hci::{Command, Event, EventToBytes, IsoData, Module, ModuleBuilder, ReturnParameters, Status};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
@@ -82,19 +81,22 @@ impl Stream {
fn new_cis(cig: &CigParameters, e: &hci::LeCisEstablished) -> Self {
let iso_interval_us = (e.iso_interval as u32) * 1250;
- assert_eq!(iso_interval_us % cig.sdu_interval_c_to_p, 0, "Framing mode not supported");
- assert_eq!(iso_interval_us % cig.sdu_interval_p_to_c, 0, "Framing mode not supported");
-
- assert_eq!(
- iso_interval_us / cig.sdu_interval_c_to_p,
- e.bn_c_to_p.into(),
- "SDU fragmentation not supported"
- );
- assert_eq!(
- iso_interval_us / cig.sdu_interval_p_to_c,
- e.bn_p_to_c.into(),
- "SDU fragmentation not supported"
- );
+ if cig.sdu_interval_c_to_p != 0 {
+ assert_eq!(iso_interval_us % cig.sdu_interval_c_to_p, 0, "Framing mode not supported");
+ assert_eq!(
+ iso_interval_us / cig.sdu_interval_c_to_p,
+ e.bn_c_to_p.into(),
+ "SDU fragmentation not supported"
+ );
+ }
+ if cig.sdu_interval_p_to_c != 0 {
+ assert_eq!(iso_interval_us % cig.sdu_interval_p_to_c, 0, "Framing mode not supported");
+ assert_eq!(
+ iso_interval_us / cig.sdu_interval_p_to_c,
+ e.bn_p_to_c.into(),
+ "SDU fragmentation not supported"
+ );
+ }
Self {
state: StreamState::Disabled,