NET: mac80211: fix inappropriate memory freeing
authorCyrill Gorcunov <[email protected]>
Fri, 14 Dec 2007 00:17:03 +0000 (16:17 -0800)
committerDavid S. Miller <[email protected]>
Thu, 20 Dec 2007 00:43:47 +0000 (16:43 -0800)
Fix inappropriate memory freeing in case of requested rate_control_ops was
not found.  In this case the list head entity is going to be accidentally
wasted.

Signed-off-by: Cyrill Gorcunov <[email protected]>
Acked-by: Michael Wu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
net/mac80211/ieee80211_rate.c

index 3260a4a0ecc5e0cd3ce08ad70bc8e5fdb8eb6300..c3f2783937419a8c0afae47b302657288d647184 100644 (file)
@@ -60,11 +60,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
        list_for_each_entry(alg, &rate_ctrl_algs, list) {
                if (alg->ops == ops) {
                        list_del(&alg->list);
+                       kfree(alg);
                        break;
                }
        }
        mutex_unlock(&rate_ctrl_mutex);
-       kfree(alg);
 }
 EXPORT_SYMBOL(ieee80211_rate_control_unregister);