Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

leandro Costantino and committed by
Greg Kroah-Hartman
096c55d1 69e09c98

+11 -10
+10 -9
drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
··· 234 234 void ieee80211_crypto_deinit(void) 235 235 { 236 236 struct list_head *ptr, *n; 237 + struct ieee80211_crypto_alg *alg = NULL; 237 238 238 239 if (hcrypt == NULL) 239 240 return; 240 241 241 - for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; 242 - ptr = n, n = ptr->next) { 243 - struct ieee80211_crypto_alg *alg = 244 - (struct ieee80211_crypto_alg *) ptr; 245 - list_del(ptr); 246 - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " 247 - "'%s' (deinit)\n", alg->ops->name); 248 - kfree(alg); 242 + list_for_each_safe(ptr, n, &hcrypt->algs) { 243 + alg = list_entry(ptr, struct ieee80211_crypto_alg, list); 244 + if (alg) { 245 + list_del(ptr); 246 + printk(KERN_DEBUG 247 + "ieee80211_crypt: unregistered algorithm '%s' (deinit)\n", 248 + alg->ops->name); 249 + kfree(alg); 250 + } 249 251 } 250 - 251 252 kfree(hcrypt); 252 253 } 253 254
+1 -1
drivers/staging/rtl8187se/r8180_core.c
··· 6161 6161 { 6162 6162 pci_unregister_driver (&rtl8180_pci_driver); 6163 6163 rtl8180_proc_module_remove(); 6164 - ieee80211_crypto_deinit(); 6165 6164 ieee80211_crypto_tkip_exit(); 6166 6165 ieee80211_crypto_ccmp_exit(); 6167 6166 ieee80211_crypto_wep_exit(); 6167 + ieee80211_crypto_deinit(); 6168 6168 DMESG("Exiting"); 6169 6169 } 6170 6170