From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752184AbdHHPGg (ORCPT ); Tue, 8 Aug 2017 11:06:36 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35914 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752014AbdHHPGe (ORCPT ); Tue, 8 Aug 2017 11:06:34 -0400 Date: Tue, 8 Aug 2017 23:05:59 +0800 From: Lynn Lei To: gregkh@linuxfoundation.org Cc: sergio.paracuellos@gmail.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/staging/wlan-ng/p80211conv.c: fixed a potential memory leak Message-ID: <20170808145245.GA21649@lynnl.yet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Lynn Lei --- drivers/staging/wlan-ng/p80211conv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index fc8ad33ade9f..c1b6d426bcad 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -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)); -- 2.13.3