Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh...
[pandora-kernel.git] / drivers / staging / rtl8187se / ieee80211 / ieee80211_softmac.c
index be2d17f..1b838a2 100644 (file)
@@ -1435,7 +1435,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
 
                if(*(t++) == MFIE_TYPE_CHALLENGE){
                        *chlen = *(t++);
-                       *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
+                       *challenge = kmalloc(*chlen, GFP_ATOMIC);
                        memcpy(*challenge, t, *chlen);
                }
        }
@@ -1555,7 +1555,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
        //IEEE80211DMESG("Rx probe");
        ieee->softmac_stats.rx_auth_rq++;
 
-       if ((status = auth_rq_parse(skb, dest))!= -1){
+       status = auth_rq_parse(skb, dest);
+       if (status != -1) {
                ieee80211_resp_to_auth(ieee, status, dest);
        }
        //DMESG("Dest is "MACSTR, MAC2STR(dest));
@@ -2321,9 +2322,11 @@ void ieee80211_disassociate(struct ieee80211_device *ieee)
 
        if(IS_DOT11D_ENABLE(ieee))
                Dot11d_Reset(ieee);
-       ieee->state = IEEE80211_NOLINK;
+
        ieee->link_change(ieee->dev);
-       notify_wx_assoc_event(ieee);
+       if (ieee->state == IEEE80211_LINKED)
+               notify_wx_assoc_event(ieee);
+       ieee->state = IEEE80211_NOLINK;
 
 }
 void ieee80211_associate_retry_wq(struct work_struct *work)
@@ -2664,11 +2667,11 @@ static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
                return -EINVAL;
 
        if (param->u.wpa_ie.len) {
-               buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL);
+               buf = kmemdup(param->u.wpa_ie.data, param->u.wpa_ie.len,
+                             GFP_KERNEL);
                if (buf == NULL)
                        return -ENOMEM;
 
-               memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len);
                kfree(ieee->wpa_ie);
                ieee->wpa_ie = buf;
                ieee->wpa_ie_len = param->u.wpa_ie.len;
@@ -2858,8 +2861,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
 
                ieee80211_crypt_delayed_deinit(ieee, crypt);
 
-               new_crypt = (struct ieee80211_crypt_data *)
-                       kmalloc(sizeof(*new_crypt), GFP_KERNEL);
+               new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
                if (new_crypt == NULL) {
                        ret = -ENOMEM;
                        goto done;
@@ -2950,7 +2952,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
                goto out;
        }
 
-       param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
+       param = kmalloc(p->length, GFP_KERNEL);
        if (param == NULL){
                ret = -ENOMEM;
                goto out;