All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dedy Lansky <qca_dlansky@qualcomm.com>
To: "John W . Linville" <linville@tuxdriver.com>
Cc: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>,
	<linux-wireless@vger.kernel.org>, <wil6210@qca.qualcomm.com>
Subject: [PATCH v2 11/13] wil6210: fix free'd memory access in wil_if_free()
Date: Wed, 6 Aug 2014 10:31:59 +0300	[thread overview]
Message-ID: <1407310322-22568-12-git-send-email-qca_dlansky@qca.qualcomm.com> (raw)
In-Reply-To: <1407310322-22568-1-git-send-email-qca_dlansky@qca.qualcomm.com>

From: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>

In the wil_priv_deinit(), wdev->netdev is accessed, so free_netdev()
should not be called before mentioned call.

Set wdev->netdev to NULL Make sure no more attempts to use it.
It is used for debug printk if not NULL.

This fix kernel panic on module unload and in case error on probe;
if memory allocation debugging enabled.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
---
 drivers/net/wireless/ath/wil6210/netdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c
index 8ee0862..59fd550 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -168,11 +168,15 @@ void *wil_if_alloc(struct device *dev, void __iomem *csr)
 void wil_if_free(struct wil6210_priv *wil)
 {
 	struct net_device *ndev = wil_to_ndev(wil);
+
 	if (!ndev)
 		return;
 
-	free_netdev(ndev);
 	wil_priv_deinit(wil);
+
+	wil_to_ndev(wil) = NULL;
+	free_netdev(ndev);
+
 	wil_wdev_free(wil);
 }
 
-- 
1.8.5.2


  parent reply	other threads:[~2014-08-06  7:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06  7:31 [PATCH v2 00/13] wil6210 misc updates Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 01/13] wil6210: map MAC timer for packet lifetime into debugfs Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 02/13] wil6210: fix race in reset Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 03/13] wil6210: update copyright year 2014 Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 04/13] wil6210: check error in wil_target_reset() Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 05/13] wil6210: wait longer for hardware reset completion Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 06/13] wil6210: Workaround for Sparrow with bad device id Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 07/13] wil6210: convert debugfs to the table mode Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 08/13] wil6210: fix beamforming data reporting Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 09/13] wil6210: fix false "scan timeout" Dedy Lansky
2014-08-06  7:31 ` [PATCH v2 10/13] wil6210: Limit max number of associated stations Dedy Lansky
2014-08-06  7:31 ` Dedy Lansky [this message]
2014-08-06  7:32 ` [PATCH v2 12/13] wil6210: cfg80211_rx_mgmt to use GFP_ATOMIC Dedy Lansky
2014-08-06  7:32 ` [PATCH v2 13/13] wil6210: fix access after free in wil_pcie_remove() Dedy Lansky
2014-08-18  7:46 ` [PATCH v2 00/13] wil6210 misc updates Vladimir Kondratiev
2014-08-20  3:04   ` John W. Linville
2014-08-20 14:01     ` Vladimir Kondratiev
2014-08-21 18:46       ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407310322-22568-12-git-send-email-qca_dlansky@qca.qualcomm.com \
    --to=qca_dlansky@qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=qca_vkondrat@qca.qualcomm.com \
    --cc=wil6210@qca.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.