cfg80211: Properly track transmitting and non-transmitting BSS
When holding data of the non-transmitting BSS, we need to keep the transmitting BSS data on. Otherwise it will be released, and release the non-transmitting BSS with it. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:

committed by
Johannes Berg

parent
1c8745f3ec
commit
a3584f56de
@@ -153,6 +153,7 @@ struct cfg80211_internal_bss {
|
||||
struct list_head list;
|
||||
struct list_head hidden_list;
|
||||
struct list_head nontrans_list;
|
||||
struct cfg80211_bss *transmitted_bss;
|
||||
struct rb_node rbn;
|
||||
u64 ts_boottime;
|
||||
unsigned long ts;
|
||||
@@ -183,12 +184,23 @@ static inline struct cfg80211_internal_bss *bss_from_pub(struct cfg80211_bss *pu
|
||||
static inline void cfg80211_hold_bss(struct cfg80211_internal_bss *bss)
|
||||
{
|
||||
atomic_inc(&bss->hold);
|
||||
if (bss->transmitted_bss) {
|
||||
bss = container_of(bss->transmitted_bss,
|
||||
struct cfg80211_internal_bss, pub);
|
||||
atomic_inc(&bss->hold);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void cfg80211_unhold_bss(struct cfg80211_internal_bss *bss)
|
||||
{
|
||||
int r = atomic_dec_return(&bss->hold);
|
||||
WARN_ON(r < 0);
|
||||
if (bss->transmitted_bss) {
|
||||
bss = container_of(bss->transmitted_bss,
|
||||
struct cfg80211_internal_bss, pub);
|
||||
r = atomic_dec_return(&bss->hold);
|
||||
WARN_ON(r < 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user