sound: fix crash on guest connection by raising max queue size
The Linux virtio-sound driver requests a queue size of 256 by default. The backend was capped at 64, causing set_vring_num to return InvalidParam which propagated as an unhandled panic. Also convert the terminal error panic to a logged error + exit(1) so future unexpected daemon errors produce a meaningful log message. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
559f2738c6
commit
0325587908
2 changed files with 9 additions and 11 deletions
|
|
@ -615,11 +615,7 @@ impl VhostUserBackend for VhostUserSoundBackend {
|
|||
}
|
||||
|
||||
fn max_queue_size(&self) -> usize {
|
||||
// The linux kernel driver does no checks for queue length and fails silently if
|
||||
// a queue is filled up. In this case, adding an element to the queue
|
||||
// returns ENOSPC and the element is not queued for a later attempt and
|
||||
// is lost. `64` is a "good enough" value from our observations.
|
||||
64
|
||||
256
|
||||
}
|
||||
|
||||
fn features(&self) -> u64 {
|
||||
|
|
|
|||
|
|
@ -328,13 +328,15 @@ pub fn start_backend_server(listener: &mut Listener, config: SoundConfig) {
|
|||
|
||||
backend.send_exit_event();
|
||||
|
||||
if !matches!(
|
||||
result,
|
||||
match result {
|
||||
Ok(()) => {}
|
||||
Err(vhost_user_backend::Error::HandleRequest(
|
||||
vhost::vhost_user::Error::Disconnected | vhost::vhost_user::Error::PartialMessage
|
||||
))
|
||||
) {
|
||||
result.unwrap();
|
||||
vhost::vhost_user::Error::Disconnected | vhost::vhost_user::Error::PartialMessage,
|
||||
)) => {}
|
||||
Err(e) => {
|
||||
log::error!("Daemon exited with error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue