From a49b19f8f65ae39c7abac3a503f290736260f123 Mon Sep 17 00:00:00 2001 From: Damien Bergamini Date: Fri, 19 May 2006 18:28:24 +0000 Subject: don't leak a mbuf with each scan command --- sys/dev/pci/if_wpi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sys/dev/pci') diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index 41303e311b4..e3d2982f235 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.5 2006/05/19 18:24:08 damien Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.6 2006/05/19 18:28:23 damien Exp $ */ /*- * Copyright (c) 2006 @@ -1159,9 +1159,21 @@ wpi_tx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, void wpi_cmd_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc) { + struct wpi_tx_ring *ring = &sc->cmdq; + struct wpi_tx_data *data; + if ((desc->qid & 7) != 4) return; /* not a command ack */ + data = &ring->data[desc->idx]; + + /* if the command was mapped in a mbuf, free it */ + if (data->m != NULL) { + bus_dmamap_unload(sc->sc_dmat, data->map); + m_freem(data->m); + data->m = NULL; + } + wakeup(&sc->cmdq.cmd[desc->idx]); } -- cgit v1.2.3