diff options
author | Mike McCormack <mikem@ring3k.org> | 2011-06-06 19:58:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-06-07 14:19:07 -0400 |
commit | 6633d649788e72400b02098bd389585e2c56a557 (patch) | |
tree | 2312cd48f3f4b8871190df945af1c3c2c9c4be39 /drivers/net/wireless/rtlwifi/pci.c | |
parent | 4fea2e0e59dab863a63fa1638b86d850896cd861 (diff) |
rtlwifi: Avoid modifying skbs that are resubmitted
In the case we fail to allocate a new skb, the old skb should
be resubmitted unmodified.
Fixes bug introduced in a9e12869758430424804.
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/pci.c')
-rw-r--r-- | drivers/net/wireless/rtlwifi/pci.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 3e055c6bad36..9f8ccae93317 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -669,6 +669,19 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
669 | &rx_status, | 669 | &rx_status, |
670 | (u8 *) pdesc, skb); | 670 | (u8 *) pdesc, skb); |
671 | 671 | ||
672 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); | ||
673 | if (unlikely(!new_skb)) { | ||
674 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), | ||
675 | DBG_DMESG, | ||
676 | ("can't alloc skb for rx\n")); | ||
677 | goto done; | ||
678 | } | ||
679 | |||
680 | pci_unmap_single(rtlpci->pdev, | ||
681 | *((dma_addr_t *) skb->cb), | ||
682 | rtlpci->rxbuffersize, | ||
683 | PCI_DMA_FROMDEVICE); | ||
684 | |||
672 | skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, | 685 | skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, |
673 | false, | 686 | false, |
674 | HW_DESC_RXPKT_LEN)); | 687 | HW_DESC_RXPKT_LEN)); |
@@ -685,21 +698,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
685 | hdr = rtl_get_hdr(skb); | 698 | hdr = rtl_get_hdr(skb); |
686 | fc = rtl_get_fc(skb); | 699 | fc = rtl_get_fc(skb); |
687 | 700 | ||
688 | /* try for new buffer - if allocation fails, drop | ||
689 | * frame and reuse old buffer | ||
690 | */ | ||
691 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); | ||
692 | if (unlikely(!new_skb)) { | ||
693 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), | ||
694 | DBG_DMESG, | ||
695 | ("can't alloc skb for rx\n")); | ||
696 | goto done; | ||
697 | } | ||
698 | pci_unmap_single(rtlpci->pdev, | ||
699 | *((dma_addr_t *) skb->cb), | ||
700 | rtlpci->rxbuffersize, | ||
701 | PCI_DMA_FROMDEVICE); | ||
702 | |||
703 | if (!stats.crc && !stats.hwerror) { | 701 | if (!stats.crc && !stats.hwerror) { |
704 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, | 702 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, |
705 | sizeof(rx_status)); | 703 | sizeof(rx_status)); |