Hello,

  thank you for your bug report. This appears to be a subtle bug
introduced in sys/dev/ic/fxp.c 1.49, a couple months short of being 20
years old.

The following diff ought to fix it. Can you give it a try on your
system?

Thanks,
Miod

Index: fxp.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/ic/fxp.c,v
retrieving revision 1.133
diff -u -p -r1.133 fxp.c
--- fxp.c       10 Nov 2023 15:51:20 -0000      1.133
+++ fxp.c       26 Feb 2024 18:10:58 -0000
@@ -1382,11 +1382,12 @@ fxp_init(void *xsc)
        else
                bufs = FXP_NRFABUFS_MIN;
        if (sc->rx_bufs > bufs) {
-               while (sc->rfa_headm != NULL && sc->rx_bufs-- > bufs) {
+               while (sc->rfa_headm != NULL && sc->rx_bufs > bufs) {
                        rxmap = *((bus_dmamap_t *)sc->rfa_headm->m_ext.ext_buf);
                        bus_dmamap_unload(sc->sc_dmat, rxmap);
                        FXP_RXMAP_PUT(sc, rxmap);
                        sc->rfa_headm = m_free(sc->rfa_headm);
+                       sc->rx_bufs--;
                }
        } else if (sc->rx_bufs < bufs) {
                int err, tmp_rx_bufs = sc->rx_bufs;

Reply via email to