Search Linux Wireless

[PATCH 2/4] cfg80211: free_priv for BSS info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>
---
 include/net/cfg80211.h |    2 ++
 net/wireless/core.c    |    2 +-
 net/wireless/scan.c    |    2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

--- wireless-testing.orig/include/net/cfg80211.h	2009-02-07 15:42:02.000000000 +0100
+++ wireless-testing/include/net/cfg80211.h	2009-02-07 15:42:12.000000000 +0100
@@ -567,6 +567,7 @@ enum cfg80211_signal_type {
  * @len_information_elements: total length of the information elements
  * @signal: signal strength value
  * @signal_type: signal type
+ * @free_priv: function pointer to free private data
  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
  */
 struct cfg80211_bss {
@@ -582,6 +583,7 @@ struct cfg80211_bss {
 	s32 signal;
 	enum cfg80211_signal_type signal_type;
 
+	void (*free_priv)(struct cfg80211_bss *bss);
 	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
 };
 
--- wireless-testing.orig/net/wireless/scan.c	2009-02-07 15:42:02.000000000 +0100
+++ wireless-testing/net/wireless/scan.c	2009-02-07 15:42:12.000000000 +0100
@@ -56,6 +56,8 @@ static void bss_release(struct kref *ref
 	struct cfg80211_internal_bss *bss;
 
 	bss = container_of(ref, struct cfg80211_internal_bss, ref);
+	if (bss->pub.free_priv)
+		bss->pub.free_priv(&bss->pub);
 	kfree(bss);
 }
 
--- wireless-testing.orig/net/wireless/core.c	2009-02-07 15:42:02.000000000 +0100
+++ wireless-testing/net/wireless/core.c	2009-02-07 15:42:12.000000000 +0100
@@ -376,7 +376,7 @@ void cfg80211_dev_free(struct cfg80211_r
 	mutex_destroy(&drv->mtx);
 	mutex_destroy(&drv->devlist_mtx);
 	list_for_each_entry_safe(scan, tmp, &drv->bss_list, list)
-		kfree(scan);
+		cfg80211_put_bss(&scan->pub);
 	kfree(drv);
 }
 

-- 

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux