@@ -62,6 +62,8 @@ struct owl_context {
62
62
struct list_head ap_list ; /**< maintaining multiple AP */
63
63
};
64
64
65
+ static DEFINE_SPINLOCK (vif_list_lock );
66
+
65
67
/* SME stands for "station management entity" */
66
68
enum sme_state { SME_DISCONNECTED , SME_CONNECTING , SME_CONNECTED };
67
69
@@ -460,13 +462,15 @@ static enum hrtimer_restart owl_beacon(struct hrtimer *timer)
460
462
if (vif -> privacy )
461
463
capability |= WLAN_CAPABILITY_PRIVACY ;
462
464
465
+ spin_lock (& vif_list_lock );
463
466
struct owl_vif * sta ;
464
467
list_for_each_entry (sta , & owl -> vif_list , list ) {
465
468
if (sta -> wdev .iftype != NL80211_IFTYPE_STATION )
466
469
continue ;
467
470
468
471
owl_beacon_inform_bss (vif , sta , & bss_meta , capability , timestamp );
469
472
}
473
+ spin_unlock (& vif_list_lock );
470
474
471
475
/* beacon at next TBTT */
472
476
u64 tsf , until_tbtt ;
@@ -1263,15 +1267,12 @@ static struct wireless_dev *owinterface_add(struct wiphy *wiphy, int if_idx)
1263
1267
hash_init (vif -> bss_sta_table );
1264
1268
1265
1269
/* Add vif into global vif_list */
1266
- if (mutex_lock_interruptible (& owl -> lock ))
1267
- goto error_add_list ;
1270
+ spin_lock_bh (& vif_list_lock );
1268
1271
list_add_tail (& vif -> list , & owl -> vif_list );
1269
- mutex_unlock ( & owl -> lock );
1272
+ spin_unlock_bh ( & vif_list_lock );
1270
1273
1271
1274
return & vif -> wdev ;
1272
1275
1273
- error_add_list :
1274
- unregister_netdev (vif -> ndev );
1275
1276
error_ndev_register :
1276
1277
free_netdev (vif -> ndev );
1277
1278
error_alloc_ndev :
@@ -1779,8 +1780,13 @@ static void owl_free(void)
1779
1780
{
1780
1781
struct owl_vif * vif = NULL , * safe = NULL ;
1781
1782
1782
- list_for_each_entry_safe (vif , safe , & owl -> vif_list , list )
1783
+ spin_lock_bh (& vif_list_lock );
1784
+ list_for_each_entry_safe (vif , safe , & owl -> vif_list , list ) {
1785
+ spin_unlock_bh (& vif_list_lock );
1783
1786
owl_delete_interface (vif );
1787
+ spin_lock_bh (& vif_list_lock );
1788
+ }
1789
+ spin_unlock_bh (& vif_list_lock );
1784
1790
1785
1791
kfree (owl );
1786
1792
}
0 commit comments