summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/if_sis.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-01-08 11:23:30 +0000
committermpi <mpi@openbsd.org>2016-01-08 11:23:30 +0000
commit5efa9773d89e0f99b4ac3595b69c8af49265b0a1 (patch)
tree6bda4e11128519edcb05f6c8d4ab17f22487b515 /sys/dev/pci/if_sis.c
parentAdd "vmm" pledge to allow restricted ioctl access to /dev/vmm. (diff)
downloadwireguard-openbsd-5efa9773d89e0f99b4ac3595b69c8af49265b0a1.tar.xz
wireguard-openbsd-5efa9773d89e0f99b4ac3595b69c8af49265b0a1.zip
Work around buggy zero-length packets produced by the DP83816A.
From Nathanael Rensen, ok dlg@
Diffstat (limited to 'sys/dev/pci/if_sis.c')
-rw-r--r--sys/dev/pci/if_sis.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index 140f6642dba..4a00ab322b2 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.132 2015/11/25 03:09:59 dlg Exp $ */
+/* $OpenBSD: if_sis.c,v 1.133 2016/01/08 11:23:30 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -1389,6 +1389,18 @@ sis_rxeof(struct sis_softc *sc)
if_rxr_put(&sc->sis_cdata.sis_rx_ring, 1);
/*
+ * DP83816A sometimes produces zero-length packets
+ * shortly after initialisation.
+ */
+ if (total_len == 0) {
+ m_freem(m);
+ continue;
+ }
+
+ /* The ethernet CRC is always included */
+ total_len -= ETHER_CRC_LEN;
+
+ /*
* If an error occurs, update stats, clear the
* status word and leave the mbuf cluster in place:
* it should simply get re-used next time this descriptor