mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: leandro Costantino <lcostantino@gmail.com>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 2/5] Staging: rtl8187se: Fix oops and memory poison caused by builtin ieee80211.
Date: Fri, 27 Feb 2009 14:49:19 -0800	[thread overview]
Message-ID: <1235774963-19732-2-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20090227224555.GB19545@kroah.com>

From: leandro Costantino <lcostantino@gmail.com>

when modprobe and removing rtl8187se ( just for testing, i do not have
that card , and oops and a memory poison error happens on the builtin
ieee80211 of that driver.  I dont know if they will port it to the
current ieeee80221 instead of the builtin ones, but just in case i
attach a proposed fix for that problem.

- Change for loop on ieee80211_crypto_deinit for list_for_each_safe to
  remove items. Is there an spinlock needed here?
- Call ieee80211_crypto_deinit after exiting all registerd crypto protocols.


Signed-off-by: Costantino Leandro <lcostantino@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 .../staging/rtl8187se/ieee80211/ieee80211_crypt.c  |   19 ++++++++++---------
 drivers/staging/rtl8187se/r8180_core.c             |    2 +-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
index af64cfb..7370296 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
@@ -234,20 +234,21 @@ out:
 void ieee80211_crypto_deinit(void)
 {
 	struct list_head *ptr, *n;
+	struct ieee80211_crypto_alg *alg = NULL;
 
 	if (hcrypt == NULL)
 		return;
 
-	for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs;
-	     ptr = n, n = ptr->next) {
-		struct ieee80211_crypto_alg *alg =
-			(struct ieee80211_crypto_alg *) ptr;
-		list_del(ptr);
-		printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm "
-		       "'%s' (deinit)\n", alg->ops->name);
-		kfree(alg);
+	list_for_each_safe(ptr, n, &hcrypt->algs) {
+		alg = list_entry(ptr, struct ieee80211_crypto_alg, list);
+		if (alg) {
+			list_del(ptr);
+			printk(KERN_DEBUG
+			       "ieee80211_crypt: unregistered algorithm '%s' (deinit)\n",
+			       alg->ops->name);
+			kfree(alg);
+		}
 	}
-
 	kfree(hcrypt);
 }
 
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 9453495..66de5cc 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -6161,10 +6161,10 @@ static void __exit rtl8180_pci_module_exit(void)
 {
 	pci_unregister_driver (&rtl8180_pci_driver);
 	rtl8180_proc_module_remove();
-	ieee80211_crypto_deinit();
 	ieee80211_crypto_tkip_exit();
 	ieee80211_crypto_ccmp_exit();
 	ieee80211_crypto_wep_exit();
+	ieee80211_crypto_deinit();
 	DMESG("Exiting");
 }
 
-- 
1.6.0.2


  parent reply	other threads:[~2009-02-27 22:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-27 22:45 [GIT PATCH] STAGING patches for 2.6-git Greg KH
2009-02-27 22:49 ` [PATCH 1/5] Staging: rtl8187se: fix Kconfig dependencies Greg Kroah-Hartman
2009-02-27 22:49 ` Greg Kroah-Hartman [this message]
2009-02-27 22:49 ` [PATCH 3/5] Staging: panel: fix oops on panel_cleanup_module Greg Kroah-Hartman
2009-02-27 22:49 ` [PATCH 4/5] Staging: w35und: fix registration with wlan stack Greg Kroah-Hartman
2009-02-27 22:49 ` [PATCH 5/5] Staging: w35und: fix usb_control_msg() error handling in wb35_probe() Greg Kroah-Hartman

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=1235774963-19732-2-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=lcostantino@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome