Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8896,6 +8896,7 @@ dependencies = [
"parking_lot",
"task_control",
"thiserror 2.0.16",
"tracelimit",
"tracing",
"virtio",
"virtio_resources",
Expand Down
1 change: 1 addition & 0 deletions vm/devices/virtio/virtio_net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ futures-concurrency.workspace = true
open_enum.workspace = true
parking_lot.workspace = true
thiserror.workspace = true
tracelimit.workspace = true
tracing.workspace = true
zerocopy.workspace = true
[lints]
Expand Down
13 changes: 12 additions & 1 deletion vm/devices/virtio/virtio_net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,18 @@ impl Worker {
WakeReason::PacketFromClient(work) => {
tracing::trace!("tx packet");
let work = work.map_err(WorkerError::VirtioQueue)?;
self.queue_tx_packet(work)?;
if let Err(err) = self.queue_tx_packet(work) {
match err {
WorkerError::Packet(_) => {
tracelimit::warn_ratelimited!(
error = &err as &dyn std::error::Error,
"dropping malformed tx packet"
);
continue;
}
other => return Err(other),
}
Comment on lines +842 to +851
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This match err { ... } moves err, but the logging line inside the WorkerError::Packet(_) arm still references err (error = &err ...). This should fail to compile with a "use of moved value" error. Restructure to match on &err (or use if let WorkerError::Packet(_) = &err { ... }) so you can borrow for logging and still propagate the owned err in the non-packet case.

Suggested change
match err {
WorkerError::Packet(_) => {
tracelimit::warn_ratelimited!(
error = &err as &dyn std::error::Error,
"dropping malformed tx packet"
);
continue;
}
other => return Err(other),
}
if let WorkerError::Packet(_) = &err {
tracelimit::warn_ratelimited!(
error = &err as &dyn std::error::Error,
"dropping malformed tx packet"
);
continue;
}
return Err(err);

Copilot uses AI. Check for mistakes.
}
self.process_virtio_rx(epqueue_state.queue.as_mut())?;
if !self.transmit_pending_segments(epqueue_state)? {
self.active_state.stats.tx_stalled.increment();
Expand Down