Skip to contentSkip to conversation

drivers/staging/wlan-ng/p80211conv.c: fixed a potential memory leak

PATCH New Lynn Lei 1 participant 1 message Aug 8, 2017 Staging

lore
Share & tools
lore

Lynn Lei

author
#0 lore raw

PATCH 1/1 drivers/staging/wlan-ng/p80211conv.c: fixed a potential memory leak

Fixed a potential memory leak inside skb_ether_to_p80211()

	When the wep_encrypt() fails  the code return 2 directly
	Which causes the p80211_wep->data dangling

Add a kfree statement to reclaim that memory allocated

---
 drivers/staging/wlan-ng/p80211conv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/wlan-ng/p80211conv.c +1 -0
index fc8ad33ade9f..c1b6d426bcad 100644
@@ -213,6 +213,7 @@ int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv,
 			netdev_warn(wlandev->netdev,
 				    "Host en-WEP failed, dropping frame (%d).\n",
 				    foo);
+			kfree(p80211_wep->data);
 			return 2;
 		}
 		fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
Signature · 1 line
2.13.3