aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2016-09-29 15:40:54 -0400
committerKalle Valo <kvalo@codeaurora.org>2016-10-07 07:22:15 -0400
commit1e54134ccad00f76ddf00f3e77db3dc8fdefbb47 (patch)
treea5143ab0e02e4fe798b013fc3fed4e8d4f77c02d /drivers/net
parentf38b7c2547537a8219d273e20eb3b88e6fc6b764 (diff)
rtl8xxxu: Fix memory leak in handling rxdesc16 packets
A device running without RX package aggregation could return more data in the USB packet than the actual network packet. In this case we could would clone the skb but then determine that that there was no packet to handle and exit without freeing the cloned skb first. This has so far only been observed with 8188eu devices, but could affect others. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Cc: stable@vger.kernel.org # 4.8+ Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index b2d7f6e69667..a96ff17759e4 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -5197,7 +5197,12 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
5197 pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift + 5197 pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift +
5198 sizeof(struct rtl8xxxu_rxdesc16), 128); 5198 sizeof(struct rtl8xxxu_rxdesc16), 128);
5199 5199
5200 if (pkt_cnt > 1) 5200 /*
5201 * Only clone the skb if there's enough data at the end to
5202 * at least cover the rx descriptor
5203 */
5204 if (pkt_cnt > 1 &&
5205 urb_len > (pkt_offset + sizeof(struct rtl8xxxu_rxdesc16)))
5201 next_skb = skb_clone(skb, GFP_ATOMIC); 5206 next_skb = skb_clone(skb, GFP_ATOMIC);
5202 5207
5203 rx_status = IEEE80211_SKB_RXCB(skb); 5208 rx_status = IEEE80211_SKB_RXCB(skb);