Commit a6c8d375 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

ath5k: properly free rx dma descriptors

When freeing rx dma descriptors, use the right buffer size.
Fixes kernel oopses on module unload on ixp4xx and most likely
other platforms as well.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Acked-by: default avatarNick Kossifidis <mickflemm@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c1b4aa3f
...@@ -310,6 +310,19 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc, ...@@ -310,6 +310,19 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc,
bf->skb = NULL; bf->skb = NULL;
} }
static inline void ath5k_rxbuf_free(struct ath5k_softc *sc,
struct ath5k_buf *bf)
{
BUG_ON(!bf);
if (!bf->skb)
return;
pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize,
PCI_DMA_FROMDEVICE);
dev_kfree_skb_any(bf->skb);
bf->skb = NULL;
}
/* Queues setup */ /* Queues setup */
static struct ath5k_txq *ath5k_txq_setup(struct ath5k_softc *sc, static struct ath5k_txq *ath5k_txq_setup(struct ath5k_softc *sc,
int qtype, int subtype); int qtype, int subtype);
...@@ -1343,7 +1356,7 @@ ath5k_desc_free(struct ath5k_softc *sc, struct pci_dev *pdev) ...@@ -1343,7 +1356,7 @@ ath5k_desc_free(struct ath5k_softc *sc, struct pci_dev *pdev)
list_for_each_entry(bf, &sc->txbuf, list) list_for_each_entry(bf, &sc->txbuf, list)
ath5k_txbuf_free(sc, bf); ath5k_txbuf_free(sc, bf);
list_for_each_entry(bf, &sc->rxbuf, list) list_for_each_entry(bf, &sc->rxbuf, list)
ath5k_txbuf_free(sc, bf); ath5k_rxbuf_free(sc, bf);
/* Free memory associated with all descriptors */ /* Free memory associated with all descriptors */
pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr); pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment