[4.20] rtlwifi: Fix leak of skb when processing C2H_BT_INFO
diff mbox series

Message ID 20181118025503.20639-1-Larry.Finger@lwfinger.net
State Accepted
Commit 8cfa272b0d321160ebb5b45073e39ef0a6ad73f2
Delegated to: Kalle Valo
Headers show
Series
  • [4.20] rtlwifi: Fix leak of skb when processing C2H_BT_INFO
Related show

Commit Message

Larry Finger Nov. 18, 2018, 2:55 a.m. UTC
With commit 0a9f8f0a1ba9 ("rtlwifi: fix btmpinfo timeout while processing
C2H_BT_INFO"), calling rtl_c2hcmd_enqueue() with rtl_c2h_fast_cmd() true,
the routine returns without freeing that skb, thereby leaking it.

This issue has been discussed at https://github.com/lwfinger/rtlwifi_new/issues/401
and the fix tested there.

Fixes: 0a9f8f0a1ba9 ("rtlwifi: fix btmpinfo timeout while processing C2H_BT_INFO")
Reported-and-tested-by: Francisco Machado Magalhães Neto <franmagneto@gmail.com>
Cc: Francisco Machado Magalhães Neto <franmagneto@gmail.com>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Stable <stable@vger.kernel.org> # 4.18+
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Kalle Valo Dec. 13, 2018, 1:38 p.m. UTC | #1
Larry Finger <Larry.Finger@lwfinger.net> wrote:

> With commit 0a9f8f0a1ba9 ("rtlwifi: fix btmpinfo timeout while processing
> C2H_BT_INFO"), calling rtl_c2hcmd_enqueue() with rtl_c2h_fast_cmd() true,
> the routine returns without freeing that skb, thereby leaking it.
> 
> This issue has been discussed at https://github.com/lwfinger/rtlwifi_new/issues/401
> and the fix tested there.
> 
> Fixes: 0a9f8f0a1ba9 ("rtlwifi: fix btmpinfo timeout while processing C2H_BT_INFO")
> Reported-and-tested-by: Francisco Machado Magalhães Neto <franmagneto@gmail.com>
> Cc: Francisco Machado Magalhães Neto <franmagneto@gmail.com>
> Cc: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Stable <stable@vger.kernel.org> # 4.18+
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

Patch applied to wireless-drivers.git, thanks.

8cfa272b0d32 rtlwifi: Fix leak of skb when processing C2H_BT_INFO

Patch
diff mbox series

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
index f4122c8fdd97..ef9b502ce576 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -2289,6 +2289,7 @@  void rtl_c2hcmd_enqueue(struct ieee80211_hw *hw, struct sk_buff *skb)
 
 	if (rtl_c2h_fast_cmd(hw, skb)) {
 		rtl_c2h_content_parsing(hw, skb);
+		kfree_skb(skb);
 		return;
 	}