[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    Staging: rtl8187se: Fix oops and memory poison caused by builtin ieee80211.
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2009-02-28 2:02:17
Message-ID: 200902280202.n1S22HcO015046 () hera ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=096c55d1de39c0de526dfeb8a68ba3b0200e5a93
                
Commit:     096c55d1de39c0de526dfeb8a68ba3b0200e5a93
Parent:     69e09c983e92cc8f4ebb9f145ba3b460f6374558
Author:     leandro Costantino <lcostantino@gmail.com>
AuthorDate: Tue Feb 17 11:16:26 2009 -0500
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Fri Feb 27 12:56:23 2009 -0800

    Staging: rtl8187se: Fix oops and memory poison caused by builtin ieee80211.
    
    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");
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic