From patchwork Wed Nov 9 03:37:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricky Liang X-Patchwork-Id: 9418433 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D1536048E for ; Wed, 9 Nov 2016 03:38:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34E0D28620 for ; Wed, 9 Nov 2016 03:38:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2996029127; Wed, 9 Nov 2016 03:38:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5D6E28620 for ; Wed, 9 Nov 2016 03:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbcKIDhj (ORCPT ); Tue, 8 Nov 2016 22:37:39 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36006 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226AbcKIDhh (ORCPT ); Tue, 8 Nov 2016 22:37:37 -0500 Received: by mail-pf0-f179.google.com with SMTP id 189so119119406pfz.3 for ; Tue, 08 Nov 2016 19:37:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=orAjPvXCY+RpqsKzLxoQEvVmGN2o1YyxqOvc3zxqdeg=; b=Dx2Fb/oO2VNmUsAqJLlV04e6jvN+ni1uOK2L7+cRBp4OYs55TAxbycmI/m/o7Jgh4C bzgN4UIniit+UwqGLt0v73IRkOMaQBO8qqLgO3m5lMhNQz3l64U3IFJHCGeWHM6pbgVj 4CTukoypEIdAdKx/c3QWffOedOWWnTGbKHkhc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=orAjPvXCY+RpqsKzLxoQEvVmGN2o1YyxqOvc3zxqdeg=; b=Sx3J1n5IbThI9OaTqljna5DXSRZ4EDyKFZqqu/nVeLK0cRxGWbltI9x09iS9Wfrs9w mzDRj46LZKGF3EBxYRUTNxu1IBkM68iLTpyp26LWkjHZblcrWyzb9uzjpANsKz7Da25b 9nP2MFds0S43iFAYR47FQKebvEa6knasUGKADS2Ypt2ke7EuoaPLa/G1jKQefhfeGGe5 hVY5k1gcytMCfwvV5hzV0r6jWxcQ6lubhwVsAHDtYTIkmjilrqOS2Q7kCszEZhMad5LZ 653Fo7P1cnj9qaNtO1/di6tQ+V7nCk5ihK5t9jlUYDAmSMl5p9O0c3RaZKA7z4XrhiMQ Lqdw== X-Gm-Message-State: ABUngve0EiGoFju5b/kQpBs15hmyPyh8N/vXoJ141fQQCe/4oO969kQ23lAD3XaiZIp/pYbE X-Received: by 10.99.173.75 with SMTP id y11mr11555411pgo.130.1478662656803; Tue, 08 Nov 2016 19:37:36 -0800 (PST) Received: from jcliang-z840.tpe.corp.google.com ([2401:fa00:1:b:2505:6271:9c6d:bc40]) by smtp.gmail.com with ESMTPSA id d1sm10358228pfb.76.2016.11.08.19.37.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Nov 2016 19:37:36 -0800 (PST) From: Ricky Liang Cc: Ricky Liang , Amitkumar Karwar , Nishant Sarmukadam , Kalle Valo , linux-wireless@vger.kernel.org (open list:MARVELL MWIFIEX WIRELESS DRIVER), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] mwifiex: fix memory leak in mwifiex_save_hidden_ssid_channels() Date: Wed, 9 Nov 2016 11:37:28 +0800 Message-Id: <1478662648-70698-1-git-send-email-jcliang@chromium.org> X-Mailer: git-send-email 2.6.6 To: unlisted-recipients:; (no To-header on input) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kmemleak reports memory leak in mwifiex_save_hidden_ssid_channels(): unreferenced object 0xffffffc0a2914780 (size 192): comm "ksdioirqd/mmc2", pid 2004, jiffies 4307182506 (age 820.684s) hex dump (first 32 bytes): 00 06 47 49 4e 2d 32 67 01 03 c8 60 6c 03 01 40 ..GIN-2g...`l..@ 07 10 54 57 20 34 04 1e 64 05 24 84 03 24 95 04 ..TW 4..d.$..$.. backtrace: [] create_object+0x164/0x2b4 [] kmemleak_alloc+0x50/0x88 [] __kmalloc_track_caller+0x1bc/0x264 [] kmemdup+0x38/0x64 [] mwifiex_fill_new_bss_desc+0x3c/0x130 [mwifiex] [] mwifiex_save_curr_bcn+0x4ec/0x640 [mwifiex] [] mwifiex_handle_event_ext_scan_report+0x1d4/0x268 [mwifiex] [] mwifiex_process_sta_event+0x378/0x898 [mwifiex] [] mwifiex_process_event+0x1a8/0x1e8 [mwifiex] [] mwifiex_main_process+0x258/0x534 [mwifiex] [] 0xffffffbffc258858 [] process_sdio_pending_irqs+0xf8/0x160 [] sdio_irq_thread+0x9c/0x1a4 [] kthread+0xf4/0x100 [] ret_from_fork+0xc/0x50 [] 0xffffffffffffffff Signed-off-by: Ricky Liang Acked-by: Amitkumar Karwar Reviewed-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/scan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c index 97c9765..98ce072 100644 --- a/drivers/net/wireless/marvell/mwifiex/scan.c +++ b/drivers/net/wireless/marvell/mwifiex/scan.c @@ -1671,6 +1671,10 @@ static int mwifiex_save_hidden_ssid_channels(struct mwifiex_private *priv, } done: + /* beacon_ie buffer was allocated in function + * mwifiex_fill_new_bss_desc(). Free it now. + */ + kfree(bss_desc->beacon_buf); kfree(bss_desc); return 0; }