@@ -777,6 +777,26 @@ void ieee80211_reset_crypto_tx_tailroom(struct ieee80211_sub_if_data *sdata)
777777 mutex_unlock (& sdata -> local -> key_mtx );
778778}
779779
780+ static void
781+ ieee80211_key_iter (struct ieee80211_hw * hw ,
782+ struct ieee80211_vif * vif ,
783+ struct ieee80211_key * key ,
784+ void (* iter )(struct ieee80211_hw * hw ,
785+ struct ieee80211_vif * vif ,
786+ struct ieee80211_sta * sta ,
787+ struct ieee80211_key_conf * key ,
788+ void * data ),
789+ void * iter_data )
790+ {
791+ /* skip keys of station in removal process */
792+ if (key -> sta && key -> sta -> removed )
793+ return ;
794+ if (!(key -> flags & KEY_FLAG_UPLOADED_TO_HARDWARE ))
795+ return ;
796+ iter (hw , vif , key -> sta ? & key -> sta -> sta : NULL ,
797+ & key -> conf , iter_data );
798+ }
799+
780800void ieee80211_iter_keys (struct ieee80211_hw * hw ,
781801 struct ieee80211_vif * vif ,
782802 void (* iter )(struct ieee80211_hw * hw ,
@@ -796,16 +816,13 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw,
796816 if (vif ) {
797817 sdata = vif_to_sdata (vif );
798818 list_for_each_entry_safe (key , tmp , & sdata -> key_list , list )
799- iter (hw , & sdata -> vif ,
800- key -> sta ? & key -> sta -> sta : NULL ,
801- & key -> conf , iter_data );
819+ ieee80211_key_iter (hw , vif , key , iter , iter_data );
802820 } else {
803821 list_for_each_entry (sdata , & local -> interfaces , list )
804822 list_for_each_entry_safe (key , tmp ,
805823 & sdata -> key_list , list )
806- iter (hw , & sdata -> vif ,
807- key -> sta ? & key -> sta -> sta : NULL ,
808- & key -> conf , iter_data );
824+ ieee80211_key_iter (hw , & sdata -> vif , key ,
825+ iter , iter_data );
809826 }
810827 mutex_unlock (& local -> key_mtx );
811828}
@@ -823,17 +840,8 @@ _ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
823840{
824841 struct ieee80211_key * key ;
825842
826- list_for_each_entry_rcu (key , & sdata -> key_list , list ) {
827- /* skip keys of station in removal process */
828- if (key -> sta && key -> sta -> removed )
829- continue ;
830- if (!(key -> flags & KEY_FLAG_UPLOADED_TO_HARDWARE ))
831- continue ;
832-
833- iter (hw , & sdata -> vif ,
834- key -> sta ? & key -> sta -> sta : NULL ,
835- & key -> conf , iter_data );
836- }
843+ list_for_each_entry_rcu (key , & sdata -> key_list , list )
844+ ieee80211_key_iter (hw , & sdata -> vif , key , iter , iter_data );
837845}
838846
839847void ieee80211_iter_keys_rcu (struct ieee80211_hw * hw ,
0 commit comments