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

mac80211: do not pass AP VLAN vif pointers to drivers

This fixes frequent WARN_ONs when using AP VLAN + aggregation, as these vifs
are virtual and not registered with drivers.
Use sta_info_get_bss instead of sta_info_get in aggregation callbacks, so
that these callbacks can find the station entry when called with the AP vif.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Felix Fietkau and committed by
John W. Linville
bc192f89 5ccc32ff

+17 -7
+1 -1
net/mac80211/agg-rx.c
··· 112 112 int i; 113 113 114 114 rcu_read_lock(); 115 - sta = sta_info_get(sdata, addr); 115 + sta = sta_info_get_bss(sdata, addr); 116 116 if (!sta) { 117 117 rcu_read_unlock(); 118 118 return;
+2 -2
net/mac80211/agg-tx.c
··· 555 555 } 556 556 557 557 mutex_lock(&local->sta_mtx); 558 - sta = sta_info_get(sdata, ra); 558 + sta = sta_info_get_bss(sdata, ra); 559 559 if (!sta) { 560 560 mutex_unlock(&local->sta_mtx); 561 561 #ifdef CONFIG_MAC80211_HT_DEBUG ··· 684 684 685 685 mutex_lock(&local->sta_mtx); 686 686 687 - sta = sta_info_get(sdata, ra); 687 + sta = sta_info_get_bss(sdata, ra); 688 688 if (!sta) { 689 689 #ifdef CONFIG_MAC80211_HT_DEBUG 690 690 printk(KERN_DEBUG "Could not find station: %pM\n", ra);
+14
net/mac80211/driver-ops.h
··· 10 10 WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)); 11 11 } 12 12 13 + static inline struct ieee80211_sub_if_data * 14 + get_bss_sdata(struct ieee80211_sub_if_data *sdata) 15 + { 16 + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 17 + sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, 18 + u.ap); 19 + 20 + return sdata; 21 + } 22 + 13 23 static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) 14 24 { 15 25 local->ops->tx(&local->hw, skb); ··· 431 421 enum sta_notify_cmd cmd, 432 422 struct ieee80211_sta *sta) 433 423 { 424 + sdata = get_bss_sdata(sdata); 434 425 check_sdata_in_driver(sdata); 435 426 436 427 trace_drv_sta_notify(local, sdata, cmd, sta); ··· 448 437 449 438 might_sleep(); 450 439 440 + sdata = get_bss_sdata(sdata); 451 441 check_sdata_in_driver(sdata); 452 442 453 443 trace_drv_sta_add(local, sdata, sta); ··· 466 454 { 467 455 might_sleep(); 468 456 457 + sdata = get_bss_sdata(sdata); 469 458 check_sdata_in_driver(sdata); 470 459 471 460 trace_drv_sta_remove(local, sdata, sta); ··· 560 547 561 548 might_sleep(); 562 549 550 + sdata = get_bss_sdata(sdata); 563 551 check_sdata_in_driver(sdata); 564 552 565 553 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
-4
net/mac80211/sta_info.c
··· 351 351 352 352 if (!sta->dummy || dummy_reinsert) { 353 353 /* notify driver */ 354 - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 355 - sdata = container_of(sdata->bss, 356 - struct ieee80211_sub_if_data, 357 - u.ap); 358 354 err = drv_sta_add(local, sdata, &sta->sta); 359 355 if (err) { 360 356 if (!async)