From: jmatthew Date: Sat, 8 Jul 2023 09:01:30 +0000 (+0000) Subject: Check rx dma map was allocated before trying to free it, so we don't crash X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=915b4b0d357ffc55204afdccfeb755b130e8471c;p=openbsd Check rx dma map was allocated before trying to free it, so we don't crash if we ran out of memory while bringing the interface up. tested by hrvoje, ok kevlo@ --- diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index b250ee48df8..195b5d63895 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.197 2023/06/01 09:05:33 jan Exp $ */ +/* $OpenBSD: if_ix.c,v 1.198 2023/07/08 09:01:30 jmatthew Exp $ */ /****************************************************************************** @@ -3094,8 +3094,11 @@ ixgbe_free_receive_buffers(struct rx_ring *rxr) m_freem(rxbuf->buf); rxbuf->buf = NULL; } - bus_dmamap_destroy(rxr->rxdma.dma_tag, rxbuf->map); - rxbuf->map = NULL; + if (rxbuf->map != NULL) { + bus_dmamap_destroy(rxr->rxdma.dma_tag, + rxbuf->map); + rxbuf->map = NULL; + } } free(rxr->rx_buffers, M_DEVBUF, sc->num_rx_desc * sizeof(struct ixgbe_rx_buf));