From patchwork Mon Dec 7 00:07:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Wu X-Patchwork-Id: 7779731 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B6FC39F350 for ; Mon, 7 Dec 2015 00:09:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E67D420489 for ; Mon, 7 Dec 2015 00:09:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09AAC20499 for ; Mon, 7 Dec 2015 00:09:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754998AbbLGAIa (ORCPT ); Sun, 6 Dec 2015 19:08:30 -0500 Received: from lekensteyn.nl ([178.21.112.251]:42935 "EHLO lekensteyn.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754132AbbLGAI2 (ORCPT ); Sun, 6 Dec 2015 19:08:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lekensteyn.nl; s=s2048-2015-q1; h=Message-Id:Date:Subject:Cc:To:From; bh=vTa2ZEolxg6FbHfnL3wY0YxZ02Dz/ftRhZc2zInlLp8=; b=VIXTZNqdbLCctaZRfYKVzoOV661V3TDIjojX3aI35xMJjRiv97LVJD/dA7BFYBsbMikQmCGChOXNvr0DuER788tmHKqJlji5249n4izGlOhXliMQDGbAEq48k4mBa2Q3/b9qmbQdilWJQbEcl5SWU7rCm+TKpQp4fUxXweNR6VSVXpzaVlr4fCnNviSeZcOQhc6SNA2aiRByePxr6Kj4hzmShB1XIgxyVb0awnWheAaM5FZLd11mhHoihDUevyIuNKB32mvlVPMnu4ldl676gpM2MXd8PDwBDBYIfdTpxfi/Td4UQ/y7uRkKRNVMmcfMHpFmqkvyx41n+cfvyP1E1g==; Received: by lekensteyn.nl with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84) (envelope-from ) id 1a5jLT-0004vl-Ud; Mon, 07 Dec 2015 01:08:15 +0100 From: Peter Wu To: Larry Finger , Chaoming Li , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH v2] rtlwifi: fix memory leak for USB device Date: Mon, 7 Dec 2015 01:07:31 +0100 Message-Id: <1449446851-2221-1-git-send-email-peter@lekensteyn.nl> X-Mailer: git-send-email 2.6.3 X-Spam-Score: 0.0 (/) X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Free skb for received frames with a wrong checksum. This can happen pretty rapidly, exhausting all memory. This fixes a memleak (detected with kmemleak). Originally found while using monitor mode, but it also appears during managed mode (once the link is up). Cc: stable@vger.kernel.org Signed-off-by: Peter Wu ACKed-by: Larry Finger --- v2: updated commit message based on Larry's feedback v1: https://lkml.kernel.org/r/1449424677-3140-1-git-send-email-peter@lekensteyn.nl Tested with v4.3, rebased on v4.4-rc3 (changed paths). The bug goes back to its introduction in the v2.6.x kernel. --- drivers/net/wireless/realtek/rtlwifi/usb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c index 2721cf8..aac1ed3 100644 --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c @@ -531,6 +531,8 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw, ieee80211_rx(hw, skb); else dev_kfree_skb_any(skb); + } else { + dev_kfree_skb_any(skb); } }