From patchwork Thu Oct 13 11:25:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prameela Rani Garnepudi X-Patchwork-Id: 9374919 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 45C5460487 for ; Thu, 13 Oct 2016 12:22:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37C1029FC7 for ; Thu, 13 Oct 2016 12:22:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C9D329FCD; Thu, 13 Oct 2016 12:22:27 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham 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 D926329FC7 for ; Thu, 13 Oct 2016 12:22:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754766AbcJMMWZ (ORCPT ); Thu, 13 Oct 2016 08:22:25 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33533 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753456AbcJMMWY (ORCPT ); Thu, 13 Oct 2016 08:22:24 -0400 Received: by mail-pf0-f193.google.com with SMTP id i85so1585103pfa.0 for ; Thu, 13 Oct 2016 05:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=M5gjbfud9RgG86U2eg3yU1oqVzRYMjLfoMFCzSzPpbc=; b=lzXoWhnDeyp2++NvxgriJc5TIDl3RKItgKqLSrw26iewmS1rQaGOPhiC1ZSExt2ujr nay0oy9zw2I3rNUOiZOaB/BeMfYLtji30xXNgdF6Hu8Be48sZTMr2qmo7RYHs6cmmjSD hh4idxXE3eVJO9C/K54YHJAdbuhDEBlP3PmkEctDwTmNnhXRVygH3yZtWVquyIXDMNOm uuKFA119x6k42V8Aim8PSV+aBKHIAKzqMemZkXW2urGW7QkGzX94NVKkOj/1VHnpr4sW ArVkmAml23JJffsz6HPMK6vXYADjSvMxv4w9kBoKSQ9mPhKeLbsM/jDqMwcfaWjOXOY/ sU1A== 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=M5gjbfud9RgG86U2eg3yU1oqVzRYMjLfoMFCzSzPpbc=; b=IcuXhr2/QEsN08gvsRVLOAiXfrV7B/LhrnW7L33EcQO35oXVS/dQZK9eybmihWuQeQ FOwKKhmFjRzH9DSayvpRlwi53jyCoSjkbovCu1cpNT3KMeh/foK2l5KumWPGXqxBYQ/O pIVqlruCzGW8gu2q8Q9TwEGppM124gpsYlXCjqtORJbOHf2H6TEK7YLB3I2QbkvmW6Bn i4Yx6DInKYETkdEEPkkLlLtqXldlH3ck6WJ+pKC5hX1EshTn7VfqDZmFP8RMn57PccR3 mJtx7Npwd39KFEFNS4ykut0HdZq3PVgs8x92cLQldZwRG0S45zGIy3Se9Ojz37sm/9af +x9w== X-Gm-Message-State: AA6/9Rk5uyoj010Frru71a0NrtZAWBsuPfK04/cwQPdRjlzIyuQB2a97qDgXMP/JKCQwfA== X-Received: by 10.99.123.28 with SMTP id w28mr7823249pgc.48.1476358155715; Thu, 13 Oct 2016 04:29:15 -0700 (PDT) Received: from lapt225.localdomain ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id u10sm19017157pau.32.2016.10.13.04.29.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 04:29:15 -0700 (PDT) From: Prameela Rani Garnepudi To: linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org, johannes.berg@intel.com, hofrat@osadl.org, xypron.glpk@gmx.de, prameela.garnepudi@redpinesignals.com, Prameela Rani Garnepudi Subject: [PATCH 1/3] rsi: Fix memory leak in module unload Date: Thu, 13 Oct 2016 16:55:46 +0530 Message-Id: <1476357946-15460-1-git-send-email-prameela.j04cs@gmail.com> X-Mailer: git-send-email 2.4.11 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 Observed crash when module is unloaded if CONFIG_RSI_DEBUGSFS is not set. Fix: Debugfs entry removal moved inside CONFIG_RSI_DEBUGSFS flag in function rsi_mac80211_detach() Memory leak found and fixed for below structures in function rsi_mac80211_detach() * channel list for each supported band * rsi debugfs info Signed-off-by: Prameela Rani Garnepudi --- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c index dbb2389..58779c0 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c @@ -194,6 +194,7 @@ static void rsi_register_rates_channels(struct rsi_hw *adapter, int band) void rsi_mac80211_detach(struct rsi_hw *adapter) { struct ieee80211_hw *hw = adapter->hw; + enum nl80211_band band; if (hw) { ieee80211_stop_queues(hw); @@ -201,7 +202,17 @@ void rsi_mac80211_detach(struct rsi_hw *adapter) ieee80211_free_hw(hw); } + for (band = 0; band < NUM_NL80211_BANDS; band++) { + struct ieee80211_supported_band *sband = + &adapter->sbands[band]; + + kfree(sband->channels); + } + +#ifdef CONFIG_RSI_DEBUGFS rsi_remove_dbgfs(adapter); + kfree(adapter->dfsentry); +#endif } EXPORT_SYMBOL_GPL(rsi_mac80211_detach);