summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJan Klemkow <jan@cvs.openbsd.org>2024-07-12 14:34:09 +0000
committerJan Klemkow <jan@cvs.openbsd.org>2024-07-12 14:34:09 +0000
commit28f1dae9cf094ce07be260ff48066b39939ee70b (patch)
tree21ba6ea5e5e20d3b0f64c9797a9cd9746a985a4e /usr.sbin
parentd3f1275fefb0ce5158cbe1cff64b9c026568721a (diff)
vmd(8): Fix error handling in tx path.
ok dv@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/vmd/vionet.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/vmd/vionet.c b/usr.sbin/vmd/vionet.c
index 4e4e2d98b81..8a82e302221 100644
--- a/usr.sbin/vmd/vionet.c
+++ b/usr.sbin/vmd/vionet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vionet.c,v 1.15 2024/07/09 18:49:05 jan Exp $ */
+/* $OpenBSD: vionet.c,v 1.16 2024/07/12 14:34:08 jan Exp $ */
/*
* Copyright (c) 2023 Dave Voutila <dv@openbsd.org>
@@ -805,10 +805,8 @@ vionet_tx(struct virtio_dev *dev)
}
/* Check if we've got a minimum viable amount of data. */
- if (chain_len < VIONET_MIN_TXLEN) {
- sz = chain_len;
+ if (chain_len < VIONET_MIN_TXLEN)
goto drop;
- }
/*
* Packet inspection for ethernet header (if using a "local"
@@ -832,7 +830,6 @@ vionet_tx(struct virtio_dev *dev)
log_warnx("%s: bad source address %s",
__func__, ether_ntoa((struct ether_addr *)
eh->ether_shost));
- sz = chain_len;
goto drop;
}
}
@@ -852,10 +849,10 @@ vionet_tx(struct virtio_dev *dev)
log_warn("%s", __func__);
goto reset;
}
- sz += sizeof(struct virtio_net_hdr);
+ chain_len += sizeof(struct virtio_net_hdr);
drop:
used->ring[used->idx & VIONET_QUEUE_MASK].id = hdr_idx;
- used->ring[used->idx & VIONET_QUEUE_MASK].len = sz;
+ used->ring[used->idx & VIONET_QUEUE_MASK].len = chain_len;
__sync_synchronize();
used->idx++;
idx++;