Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: mac80211: remove key_mtx

We now hold the wiphy mutex everywhere that we use or
needed the key_mtx, so we don't need this mutex any
more. Remove it.

Most of this change was done automatically with spatch.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+90 -132
+11 -23
net/mac80211/cfg.c
··· 452 452 if (sta->ptk_idx == key_idx) 453 453 return 0; 454 454 455 - mutex_lock(&local->key_mtx); 456 - key = key_mtx_dereference(local, sta->ptk[key_idx]); 455 + key = wiphy_dereference(local->hw.wiphy, sta->ptk[key_idx]); 457 456 458 457 if (key && key->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) 459 458 ret = ieee80211_set_tx_key(key); 460 459 461 - mutex_unlock(&local->key_mtx); 462 460 return ret; 463 461 } 464 462 ··· 597 599 } 598 600 599 601 if (pairwise && key_idx < NUM_DEFAULT_KEYS) 600 - return rcu_dereference_check_key_mtx(local, 601 - sta->ptk[key_idx]); 602 + return wiphy_dereference(local->hw.wiphy, 603 + sta->ptk[key_idx]); 602 604 603 605 if (!pairwise && 604 606 key_idx < NUM_DEFAULT_KEYS + 605 607 NUM_DEFAULT_MGMT_KEYS + 606 608 NUM_DEFAULT_BEACON_KEYS) 607 - return rcu_dereference_check_key_mtx(local, 608 - link_sta->gtk[key_idx]); 609 + return wiphy_dereference(local->hw.wiphy, 610 + link_sta->gtk[key_idx]); 609 611 610 612 return NULL; 611 613 } 612 614 613 615 if (pairwise && key_idx < NUM_DEFAULT_KEYS) 614 - return rcu_dereference_check_key_mtx(local, 615 - sdata->keys[key_idx]); 616 + return wiphy_dereference(local->hw.wiphy, sdata->keys[key_idx]); 616 617 617 - key = rcu_dereference_check_key_mtx(local, link->gtk[key_idx]); 618 + key = wiphy_dereference(local->hw.wiphy, link->gtk[key_idx]); 618 619 if (key) 619 620 return key; 620 621 621 622 /* or maybe it was a WEP key */ 622 623 if (key_idx < NUM_DEFAULT_KEYS) 623 - return rcu_dereference_check_key_mtx(local, sdata->keys[key_idx]); 624 + return wiphy_dereference(local->hw.wiphy, sdata->keys[key_idx]); 624 625 625 626 return NULL; 626 627 } ··· 631 634 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 632 635 struct ieee80211_local *local = sdata->local; 633 636 struct ieee80211_key *key; 634 - int ret; 635 637 636 638 lockdep_assert_wiphy(local->hw.wiphy); 637 639 638 - mutex_lock(&local->key_mtx); 639 - 640 640 key = ieee80211_lookup_key(sdata, link_id, key_idx, pairwise, mac_addr); 641 - if (!key) { 642 - ret = -ENOENT; 643 - goto out_unlock; 644 - } 641 + if (!key) 642 + return -ENOENT; 645 643 646 644 ieee80211_key_free(key, sdata->vif.type == NL80211_IFTYPE_STATION); 647 645 648 - ret = 0; 649 - out_unlock: 650 - mutex_unlock(&local->key_mtx); 651 - 652 - return ret; 646 + return 0; 653 647 } 654 648 655 649 static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
+10 -10
net/mac80211/debugfs_key.c
··· 4 4 * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> 5 5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 6 * Copyright (C) 2015 Intel Deutschland GmbH 7 - * Copyright (C) 2021-2022 Intel Corporation 7 + * Copyright (C) 2021-2023 Intel Corporation 8 8 */ 9 9 10 10 #include <linux/kobject.h> ··· 378 378 if (!sdata->vif.debugfs_dir) 379 379 return; 380 380 381 - lockdep_assert_held(&sdata->local->key_mtx); 381 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 382 382 383 383 debugfs_remove(sdata->debugfs.default_unicast_key); 384 384 sdata->debugfs.default_unicast_key = NULL; 385 385 386 386 if (sdata->default_unicast_key) { 387 - key = key_mtx_dereference(sdata->local, 388 - sdata->default_unicast_key); 387 + key = wiphy_dereference(sdata->local->hw.wiphy, 388 + sdata->default_unicast_key); 389 389 sprintf(buf, "../keys/%d", key->debugfs.cnt); 390 390 sdata->debugfs.default_unicast_key = 391 391 debugfs_create_symlink("default_unicast_key", ··· 396 396 sdata->debugfs.default_multicast_key = NULL; 397 397 398 398 if (sdata->deflink.default_multicast_key) { 399 - key = key_mtx_dereference(sdata->local, 400 - sdata->deflink.default_multicast_key); 399 + key = wiphy_dereference(sdata->local->hw.wiphy, 400 + sdata->deflink.default_multicast_key); 401 401 sprintf(buf, "../keys/%d", key->debugfs.cnt); 402 402 sdata->debugfs.default_multicast_key = 403 403 debugfs_create_symlink("default_multicast_key", ··· 413 413 if (!sdata->vif.debugfs_dir) 414 414 return; 415 415 416 - key = key_mtx_dereference(sdata->local, 417 - sdata->deflink.default_mgmt_key); 416 + key = wiphy_dereference(sdata->local->hw.wiphy, 417 + sdata->deflink.default_mgmt_key); 418 418 if (key) { 419 419 sprintf(buf, "../keys/%d", key->debugfs.cnt); 420 420 sdata->debugfs.default_mgmt_key = ··· 442 442 if (!sdata->vif.debugfs_dir) 443 443 return; 444 444 445 - key = key_mtx_dereference(sdata->local, 446 - sdata->deflink.default_beacon_key); 445 + key = wiphy_dereference(sdata->local->hw.wiphy, 446 + sdata->deflink.default_beacon_key); 447 447 if (key) { 448 448 sprintf(buf, "../keys/%d", key->debugfs.cnt); 449 449 sdata->debugfs.default_beacon_key =
-6
net/mac80211/ieee80211_i.h
··· 1466 1466 struct list_head mon_list; /* only that are IFF_UP && !cooked */ 1467 1467 struct mutex iflist_mtx; 1468 1468 1469 - /* 1470 - * Key mutex, protects sdata's key_list and sta_info's 1471 - * key pointers and ptk_idx (write access, they're RCU.) 1472 - */ 1473 - struct mutex key_mtx; 1474 - 1475 1469 /* mutex for scan and work locking */ 1476 1470 struct mutex mtx; 1477 1471
+2 -2
net/mac80211/iface.c
··· 1245 1245 int res; 1246 1246 u32 hw_reconf_flags = 0; 1247 1247 1248 + lockdep_assert_wiphy(local->hw.wiphy); 1249 + 1248 1250 switch (sdata->vif.type) { 1249 1251 case NL80211_IFTYPE_AP_VLAN: { 1250 1252 struct ieee80211_sub_if_data *master; ··· 1273 1271 sizeof(sdata->vif.hw_queue)); 1274 1272 sdata->vif.bss_conf.chandef = master->vif.bss_conf.chandef; 1275 1273 1276 - mutex_lock(&local->key_mtx); 1277 1274 sdata->crypto_tx_tailroom_needed_cnt += 1278 1275 master->crypto_tx_tailroom_needed_cnt; 1279 - mutex_unlock(&local->key_mtx); 1280 1276 1281 1277 break; 1282 1278 }
+64 -80
net/mac80211/key.c
··· 53 53 54 54 static const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 55 55 56 - static void assert_key_lock(struct ieee80211_local *local) 57 - { 58 - lockdep_assert_held(&local->key_mtx); 59 - } 60 - 61 56 static void 62 57 update_vlan_tailroom_need_count(struct ieee80211_sub_if_data *sdata, int delta) 63 58 { ··· 62 67 return; 63 68 64 69 /* crypto_tx_tailroom_needed_cnt is protected by this */ 65 - assert_key_lock(sdata->local); 70 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 66 71 67 72 rcu_read_lock(); 68 73 ··· 93 98 * http://mid.gmane.org/1308590980.4322.19.camel@jlt3.sipsolutions.net 94 99 */ 95 100 96 - assert_key_lock(sdata->local); 101 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 97 102 98 103 update_vlan_tailroom_need_count(sdata, 1); 99 104 ··· 109 114 static void decrease_tailroom_need_count(struct ieee80211_sub_if_data *sdata, 110 115 int delta) 111 116 { 112 - assert_key_lock(sdata->local); 117 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 113 118 114 119 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt < delta); 115 120 ··· 124 129 int ret = -EOPNOTSUPP; 125 130 126 131 might_sleep(); 132 + lockdep_assert_wiphy(key->local->hw.wiphy); 127 133 128 134 if (key->flags & KEY_FLAG_TAINTED) { 129 135 /* If we get here, it's during resume and the key is ··· 146 150 147 151 if (!key->local->ops->set_key) 148 152 goto out_unsupported; 149 - 150 - assert_key_lock(key->local); 151 153 152 154 sta = key->sta; 153 155 ··· 236 242 if (!key || !key->local->ops->set_key) 237 243 return; 238 244 239 - assert_key_lock(key->local); 240 - 241 245 if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 242 246 return; 243 247 244 248 sta = key->sta; 245 249 sdata = key->sdata; 250 + 251 + lockdep_assert_wiphy(key->local->hw.wiphy); 246 252 247 253 if (key->conf.link_id >= 0 && sdata->vif.active_links && 248 254 !(sdata->vif.active_links & BIT(key->conf.link_id))) ··· 269 275 struct sta_info *sta = key->sta; 270 276 struct ieee80211_local *local = key->local; 271 277 272 - assert_key_lock(local); 278 + lockdep_assert_wiphy(local->hw.wiphy); 273 279 274 280 set_sta_flag(sta, WLAN_STA_USES_ENCRYPTION); 275 281 ··· 294 300 struct sta_info *sta = new->sta; 295 301 int i; 296 302 297 - assert_key_lock(local); 303 + lockdep_assert_wiphy(local->hw.wiphy); 298 304 299 305 if (new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX) { 300 306 /* Extended Key ID key install, initial one or rekey */ ··· 352 358 struct ieee80211_sub_if_data *sdata = link->sdata; 353 359 struct ieee80211_key *key = NULL; 354 360 355 - assert_key_lock(sdata->local); 361 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 356 362 357 363 if (idx >= 0 && idx < NUM_DEFAULT_KEYS) { 358 - key = key_mtx_dereference(sdata->local, sdata->keys[idx]); 364 + key = wiphy_dereference(sdata->local->hw.wiphy, 365 + sdata->keys[idx]); 359 366 if (!key) 360 - key = key_mtx_dereference(sdata->local, link->gtk[idx]); 367 + key = wiphy_dereference(sdata->local->hw.wiphy, 368 + link->gtk[idx]); 361 369 } 362 370 363 371 if (uni) { ··· 378 382 void ieee80211_set_default_key(struct ieee80211_link_data *link, int idx, 379 383 bool uni, bool multi) 380 384 { 381 - mutex_lock(&link->sdata->local->key_mtx); 385 + lockdep_assert_wiphy(link->sdata->local->hw.wiphy); 386 + 382 387 __ieee80211_set_default_key(link, idx, uni, multi); 383 - mutex_unlock(&link->sdata->local->key_mtx); 384 388 } 385 389 386 390 static void ··· 389 393 struct ieee80211_sub_if_data *sdata = link->sdata; 390 394 struct ieee80211_key *key = NULL; 391 395 392 - assert_key_lock(sdata->local); 396 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 393 397 394 398 if (idx >= NUM_DEFAULT_KEYS && 395 399 idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) 396 - key = key_mtx_dereference(sdata->local, link->gtk[idx]); 400 + key = wiphy_dereference(sdata->local->hw.wiphy, 401 + link->gtk[idx]); 397 402 398 403 rcu_assign_pointer(link->default_mgmt_key, key); 399 404 ··· 404 407 void ieee80211_set_default_mgmt_key(struct ieee80211_link_data *link, 405 408 int idx) 406 409 { 407 - mutex_lock(&link->sdata->local->key_mtx); 410 + lockdep_assert_wiphy(link->sdata->local->hw.wiphy); 411 + 408 412 __ieee80211_set_default_mgmt_key(link, idx); 409 - mutex_unlock(&link->sdata->local->key_mtx); 410 413 } 411 414 412 415 static void ··· 415 418 struct ieee80211_sub_if_data *sdata = link->sdata; 416 419 struct ieee80211_key *key = NULL; 417 420 418 - assert_key_lock(sdata->local); 421 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 419 422 420 423 if (idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS && 421 424 idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS + 422 425 NUM_DEFAULT_BEACON_KEYS) 423 - key = key_mtx_dereference(sdata->local, link->gtk[idx]); 426 + key = wiphy_dereference(sdata->local->hw.wiphy, 427 + link->gtk[idx]); 424 428 425 429 rcu_assign_pointer(link->default_beacon_key, key); 426 430 ··· 431 433 void ieee80211_set_default_beacon_key(struct ieee80211_link_data *link, 432 434 int idx) 433 435 { 434 - mutex_lock(&link->sdata->local->key_mtx); 436 + lockdep_assert_wiphy(link->sdata->local->hw.wiphy); 437 + 435 438 __ieee80211_set_default_beacon_key(link, idx); 436 - mutex_unlock(&link->sdata->local->key_mtx); 437 439 } 438 440 439 441 static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, ··· 449 451 int ret = 0; 450 452 bool defunikey, defmultikey, defmgmtkey, defbeaconkey; 451 453 bool is_wep; 454 + 455 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 452 456 453 457 /* caller must provide at least one old/new */ 454 458 if (WARN_ON(!new && !old)) ··· 510 510 ret = ieee80211_key_enable_hw_accel(new); 511 511 } 512 512 } else { 513 - if (!new->local->wowlan) { 513 + if (!new->local->wowlan) 514 514 ret = ieee80211_key_enable_hw_accel(new); 515 - } else { 516 - assert_key_lock(new->local); 515 + else 517 516 new->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; 518 - } 519 517 } 520 518 521 519 if (ret) ··· 539 541 ieee80211_check_fast_rx(sta); 540 542 } else { 541 543 defunikey = old && 542 - old == key_mtx_dereference(sdata->local, 543 - sdata->default_unicast_key); 544 + old == wiphy_dereference(sdata->local->hw.wiphy, 545 + sdata->default_unicast_key); 544 546 defmultikey = old && 545 - old == key_mtx_dereference(sdata->local, 546 - link->default_multicast_key); 547 + old == wiphy_dereference(sdata->local->hw.wiphy, 548 + link->default_multicast_key); 547 549 defmgmtkey = old && 548 - old == key_mtx_dereference(sdata->local, 549 - link->default_mgmt_key); 550 + old == wiphy_dereference(sdata->local->hw.wiphy, 551 + link->default_mgmt_key); 550 552 defbeaconkey = old && 551 - old == key_mtx_dereference(sdata->local, 552 - link->default_beacon_key); 553 + old == wiphy_dereference(sdata->local->hw.wiphy, 554 + link->default_beacon_key); 553 555 554 556 if (defunikey && !new) 555 557 __ieee80211_set_default_key(link, -1, true, false); ··· 853 855 * can cause warnings to appear. 854 856 */ 855 857 bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION; 856 - int ret = -EOPNOTSUPP; 858 + int ret; 857 859 858 - mutex_lock(&sdata->local->key_mtx); 860 + lockdep_assert_wiphy(sdata->local->hw.wiphy); 859 861 860 862 if (sta && pairwise) { 861 863 struct ieee80211_key *alt_key; 862 864 863 - old_key = key_mtx_dereference(sdata->local, sta->ptk[idx]); 864 - alt_key = key_mtx_dereference(sdata->local, sta->ptk[idx ^ 1]); 865 + old_key = wiphy_dereference(sdata->local->hw.wiphy, 866 + sta->ptk[idx]); 867 + alt_key = wiphy_dereference(sdata->local->hw.wiphy, 868 + sta->ptk[idx ^ 1]); 865 869 866 870 /* The rekey code assumes that the old and new key are using 867 871 * the same cipher. Enforce the assumption for pairwise keys. 868 872 */ 869 873 if ((alt_key && alt_key->conf.cipher != key->conf.cipher) || 870 874 (old_key && old_key->conf.cipher != key->conf.cipher)) 871 - goto out; 875 + return -EOPNOTSUPP; 872 876 } else if (sta) { 873 877 struct link_sta_info *link_sta = &sta->deflink; 874 878 int link_id = key->conf.link_id; ··· 878 878 if (link_id >= 0) { 879 879 link_sta = rcu_dereference_protected(sta->link[link_id], 880 880 lockdep_is_held(&sta->local->hw.wiphy->mtx)); 881 - if (!link_sta) { 882 - ret = -ENOLINK; 883 - goto out; 884 - } 881 + if (!link_sta) 882 + return -ENOLINK; 885 883 } 886 884 887 - old_key = key_mtx_dereference(sdata->local, link_sta->gtk[idx]); 885 + old_key = wiphy_dereference(sdata->local->hw.wiphy, 886 + link_sta->gtk[idx]); 888 887 } else { 889 888 if (idx < NUM_DEFAULT_KEYS) 890 - old_key = key_mtx_dereference(sdata->local, 891 - sdata->keys[idx]); 889 + old_key = wiphy_dereference(sdata->local->hw.wiphy, 890 + sdata->keys[idx]); 892 891 if (!old_key) 893 - old_key = key_mtx_dereference(sdata->local, 894 - link->gtk[idx]); 892 + old_key = wiphy_dereference(sdata->local->hw.wiphy, 893 + link->gtk[idx]); 895 894 } 896 895 897 896 /* Non-pairwise keys must also not switch the cipher on rekey */ 898 897 if (!pairwise) { 899 898 if (old_key && old_key->conf.cipher != key->conf.cipher) 900 - goto out; 899 + return -EOPNOTSUPP; 901 900 } 902 901 903 902 /* ··· 905 906 */ 906 907 if (ieee80211_key_identical(sdata, old_key, key)) { 907 908 ieee80211_key_free_unused(key); 908 - ret = 0; 909 - goto out; 909 + return 0; 910 910 } 911 911 912 912 key->local = sdata->local; ··· 928 930 } else { 929 931 ieee80211_key_free(key, delay_tailroom); 930 932 } 931 - 932 - out: 933 - mutex_unlock(&sdata->local->key_mtx); 934 933 935 934 return ret; 936 935 } ··· 954 959 955 960 lockdep_assert_wiphy(sdata->local->hw.wiphy); 956 961 957 - mutex_lock(&sdata->local->key_mtx); 958 - 959 962 sdata->crypto_tx_tailroom_needed_cnt = 0; 960 963 sdata->crypto_tx_tailroom_pending_dec = 0; 961 964 ··· 970 977 ieee80211_key_enable_hw_accel(key); 971 978 } 972 979 } 973 - 974 - mutex_unlock(&sdata->local->key_mtx); 975 980 } 976 981 977 982 void ieee80211_iter_keys(struct ieee80211_hw *hw, ··· 987 996 988 997 lockdep_assert_wiphy(hw->wiphy); 989 998 990 - mutex_lock(&local->key_mtx); 991 999 if (vif) { 992 1000 sdata = vif_to_sdata(vif); 993 1001 list_for_each_entry_safe(key, tmp, &sdata->key_list, list) ··· 1001 1011 key->sta ? &key->sta->sta : NULL, 1002 1012 &key->conf, iter_data); 1003 1013 } 1004 - mutex_unlock(&local->key_mtx); 1005 1014 } 1006 1015 EXPORT_SYMBOL(ieee80211_iter_keys); 1007 1016 ··· 1080 1091 struct ieee80211_local *local = sdata->local; 1081 1092 struct ieee80211_key *key, *tmp; 1082 1093 1083 - mutex_lock(&local->key_mtx); 1094 + lockdep_assert_wiphy(local->hw.wiphy); 1095 + 1084 1096 list_for_each_entry_safe(key, tmp, &sdata->key_list, list) { 1085 1097 if (key->conf.link_id != link->link_id) 1086 1098 continue; ··· 1090 1100 key, NULL); 1091 1101 list_add_tail(&key->list, keys); 1092 1102 } 1093 - mutex_unlock(&local->key_mtx); 1094 1103 } 1095 1104 1096 1105 void ieee80211_free_key_list(struct ieee80211_local *local, ··· 1097 1108 { 1098 1109 struct ieee80211_key *key, *tmp; 1099 1110 1100 - mutex_lock(&local->key_mtx); 1111 + lockdep_assert_wiphy(local->hw.wiphy); 1112 + 1101 1113 list_for_each_entry_safe(key, tmp, keys, list) 1102 1114 __ieee80211_key_destroy(key, false); 1103 - mutex_unlock(&local->key_mtx); 1104 1115 } 1105 1116 1106 1117 void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, ··· 1115 1126 wiphy_delayed_work_cancel(local->hw.wiphy, 1116 1127 &sdata->dec_tailroom_needed_wk); 1117 1128 1118 - mutex_lock(&local->key_mtx); 1129 + lockdep_assert_wiphy(local->hw.wiphy); 1119 1130 1120 1131 ieee80211_free_keys_iface(sdata, &keys); 1121 1132 ··· 1148 1159 WARN_ON_ONCE(vlan->crypto_tx_tailroom_needed_cnt || 1149 1160 vlan->crypto_tx_tailroom_pending_dec); 1150 1161 } 1151 - 1152 - mutex_unlock(&local->key_mtx); 1153 1162 } 1154 1163 1155 1164 void ieee80211_free_sta_keys(struct ieee80211_local *local, ··· 1156 1169 struct ieee80211_key *key; 1157 1170 int i; 1158 1171 1159 - mutex_lock(&local->key_mtx); 1172 + lockdep_assert_wiphy(local->hw.wiphy); 1173 + 1160 1174 for (i = 0; i < ARRAY_SIZE(sta->deflink.gtk); i++) { 1161 - key = key_mtx_dereference(local, sta->deflink.gtk[i]); 1175 + key = wiphy_dereference(local->hw.wiphy, sta->deflink.gtk[i]); 1162 1176 if (!key) 1163 1177 continue; 1164 1178 ieee80211_key_replace(key->sdata, NULL, key->sta, ··· 1170 1182 } 1171 1183 1172 1184 for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 1173 - key = key_mtx_dereference(local, sta->ptk[i]); 1185 + key = wiphy_dereference(local->hw.wiphy, sta->ptk[i]); 1174 1186 if (!key) 1175 1187 continue; 1176 1188 ieee80211_key_replace(key->sdata, NULL, key->sta, ··· 1179 1191 __ieee80211_key_destroy(key, key->sdata->vif.type == 1180 1192 NL80211_IFTYPE_STATION); 1181 1193 } 1182 - 1183 - mutex_unlock(&local->key_mtx); 1184 1194 } 1185 1195 1186 1196 void ieee80211_delayed_tailroom_dec(struct wiphy *wiphy, ··· 1205 1219 * within an ESS this usually won't happen. 1206 1220 */ 1207 1221 1208 - mutex_lock(&sdata->local->key_mtx); 1209 1222 decrease_tailroom_need_count(sdata, 1210 1223 sdata->crypto_tx_tailroom_pending_dec); 1211 1224 sdata->crypto_tx_tailroom_pending_dec = 0; 1212 - mutex_unlock(&sdata->local->key_mtx); 1213 1225 } 1214 1226 1215 1227 void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid, ··· 1336 1352 1337 1353 key = container_of(keyconf, struct ieee80211_key, conf); 1338 1354 1339 - assert_key_lock(key->local); 1355 + lockdep_assert_wiphy(key->local->hw.wiphy); 1340 1356 1341 1357 /* 1342 1358 * if key was uploaded, we assume the driver will/has remove(d)
-6
net/mac80211/key.h
··· 168 168 int ieee80211_key_switch_links(struct ieee80211_sub_if_data *sdata, 169 169 unsigned long del_links_mask, 170 170 unsigned long add_links_mask); 171 - 172 - #define key_mtx_dereference(local, ref) \ 173 - rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) 174 - #define rcu_dereference_check_key_mtx(local, ref) \ 175 - rcu_dereference_check(ref, lockdep_is_held(&((local)->key_mtx))) 176 - 177 171 void ieee80211_delayed_tailroom_dec(struct wiphy *wiphy, 178 172 struct wiphy_work *wk); 179 173
+1 -2
net/mac80211/link.c
··· 456 456 457 457 sdata_assert_lock(sdata); 458 458 lockdep_assert_wiphy(local->hw.wiphy); 459 + 459 460 mutex_lock(&local->mtx); 460 - mutex_lock(&local->key_mtx); 461 461 old_active = sdata->vif.active_links; 462 462 if (old_active & active_links) { 463 463 /* ··· 473 473 /* otherwise switch directly */ 474 474 ret = _ieee80211_set_active_links(sdata, active_links); 475 475 } 476 - mutex_unlock(&local->key_mtx); 477 476 mutex_unlock(&local->mtx); 478 477 479 478 return ret;
-1
net/mac80211/main.c
··· 806 806 mutex_init(&local->iflist_mtx); 807 807 mutex_init(&local->mtx); 808 808 809 - mutex_init(&local->key_mtx); 810 809 spin_lock_init(&local->filter_lock); 811 810 spin_lock_init(&local->rx_path_lock); 812 811 spin_lock_init(&local->queue_stop_reason_lock);
+2 -2
net/mac80211/util.c
··· 2987 2987 sdata = vif_to_sdata(vif); 2988 2988 local = sdata->local; 2989 2989 2990 + lockdep_assert_wiphy(local->hw.wiphy); 2991 + 2990 2992 if (WARN_ON(flag & IEEE80211_SDATA_DISCONNECT_RESUME && 2991 2993 !local->resuming)) 2992 2994 return; ··· 3002 3000 3003 3001 sdata->flags |= flag; 3004 3002 3005 - mutex_lock(&local->key_mtx); 3006 3003 list_for_each_entry(key, &sdata->key_list, list) 3007 3004 key->flags |= KEY_FLAG_TAINTED; 3008 - mutex_unlock(&local->key_mtx); 3009 3005 } 3010 3006 3011 3007 void ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif)