aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-10 15:25:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:53 -0500
commit78c1c7e109f1f14e7c18f290c4ebc58da220c7ba (patch)
tree11d4666d578dc6f9ee4c57dfe3fb4e8498d9ed79
parent99cf5f5f3571ce3a837e379d3b87bf5ddf54f17d (diff)
cfg80211: free_priv for BSS info
When cfg80211 users have their own allocated data in the per-BSS private data, they will need to free this when the BSS struct is destroyed. Add a free_priv method and fix one place where the BSS was kfree'd rather than released properly. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--net/wireless/core.c2
-rw-r--r--net/wireless/scan.c2
3 files changed, 5 insertions, 1 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 09a0b268e5cf..b514abcc2b93 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -567,6 +567,7 @@ enum cfg80211_signal_type {
567 * @len_information_elements: total length of the information elements 567 * @len_information_elements: total length of the information elements
568 * @signal: signal strength value 568 * @signal: signal strength value
569 * @signal_type: signal type 569 * @signal_type: signal type
570 * @free_priv: function pointer to free private data
570 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 571 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
571 */ 572 */
572struct cfg80211_bss { 573struct cfg80211_bss {
@@ -582,6 +583,7 @@ struct cfg80211_bss {
582 s32 signal; 583 s32 signal;
583 enum cfg80211_signal_type signal_type; 584 enum cfg80211_signal_type signal_type;
584 585
586 void (*free_priv)(struct cfg80211_bss *bss);
585 u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 587 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
586}; 588};
587 589
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 3cccd1390cea..0668b2bfc1da 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -376,7 +376,7 @@ void cfg80211_dev_free(struct cfg80211_registered_device *drv)
376 mutex_destroy(&drv->mtx); 376 mutex_destroy(&drv->mtx);
377 mutex_destroy(&drv->devlist_mtx); 377 mutex_destroy(&drv->devlist_mtx);
378 list_for_each_entry_safe(scan, tmp, &drv->bss_list, list) 378 list_for_each_entry_safe(scan, tmp, &drv->bss_list, list)
379 kfree(scan); 379 cfg80211_put_bss(&scan->pub);
380 kfree(drv); 380 kfree(drv);
381} 381}
382 382
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 009d12810c55..ec148f68a62b 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -56,6 +56,8 @@ static void bss_release(struct kref *ref)
56 struct cfg80211_internal_bss *bss; 56 struct cfg80211_internal_bss *bss;
57 57
58 bss = container_of(ref, struct cfg80211_internal_bss, ref); 58 bss = container_of(ref, struct cfg80211_internal_bss, ref);
59 if (bss->pub.free_priv)
60 bss->pub.free_priv(&bss->pub);
59 kfree(bss); 61 kfree(bss);
60} 62}
61 63