sta_info.c (8632987380765dee716d460640aa58d58d52998e) | sta_info.c (4dde3c3627b52ca515a34f6f4de3898224aa1dd3) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright 2002-2005, Instant802 Networks, Inc. 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH 7 * Copyright (C) 2018-2021 Intel Corporation 8 */ --- 630 unchanged lines hidden (view full) --- 639 struct station_info *sinfo = NULL; 640 int err = 0; 641 642 lockdep_assert_held(&local->sta_mtx); 643 644 /* check if STA exists already */ 645 if (sta_info_get_bss(sdata, sta->sta.addr)) { 646 err = -EEXIST; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright 2002-2005, Instant802 Networks, Inc. 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH 7 * Copyright (C) 2018-2021 Intel Corporation 8 */ --- 630 unchanged lines hidden (view full) --- 639 struct station_info *sinfo = NULL; 640 int err = 0; 641 642 lockdep_assert_held(&local->sta_mtx); 643 644 /* check if STA exists already */ 645 if (sta_info_get_bss(sdata, sta->sta.addr)) { 646 err = -EEXIST; |
647 goto out_err; | 647 goto out_cleanup; |
648 } 649 650 sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL); 651 if (!sinfo) { 652 err = -ENOMEM; | 648 } 649 650 sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL); 651 if (!sinfo) { 652 err = -ENOMEM; |
653 goto out_err; | 653 goto out_cleanup; |
654 } 655 656 local->num_sta++; 657 local->sta_generation++; 658 smp_mb(); 659 660 /* simplify things and don't accept BA sessions yet */ 661 set_sta_flag(sta, WLAN_STA_BLOCK_BA); 662 663 /* make the station visible */ 664 err = sta_info_hash_add(local, sta); 665 if (err) 666 goto out_drop_sta; 667 668 list_add_tail_rcu(&sta->list, &local->sta_list); 669 | 654 } 655 656 local->num_sta++; 657 local->sta_generation++; 658 smp_mb(); 659 660 /* simplify things and don't accept BA sessions yet */ 661 set_sta_flag(sta, WLAN_STA_BLOCK_BA); 662 663 /* make the station visible */ 664 err = sta_info_hash_add(local, sta); 665 if (err) 666 goto out_drop_sta; 667 668 list_add_tail_rcu(&sta->list, &local->sta_list); 669 |
670 /* update channel context before notifying the driver about state 671 * change, this enables driver using the updated channel context right away. 672 */ 673 if (sta->sta_state >= IEEE80211_STA_ASSOC) { 674 ieee80211_recalc_min_chandef(sta->sdata); 675 if (!sta->sta.support_p2p_ps) 676 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); 677 } 678 |
|
670 /* notify driver */ 671 err = sta_info_insert_drv_state(local, sdata, sta); 672 if (err) 673 goto out_remove; 674 675 set_sta_flag(sta, WLAN_STA_INSERTED); 676 | 679 /* notify driver */ 680 err = sta_info_insert_drv_state(local, sdata, sta); 681 if (err) 682 goto out_remove; 683 684 set_sta_flag(sta, WLAN_STA_INSERTED); 685 |
677 if (sta->sta_state >= IEEE80211_STA_ASSOC) { 678 ieee80211_recalc_min_chandef(sta->sdata); 679 if (!sta->sta.support_p2p_ps) 680 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); 681 } 682 | |
683 /* accept BA sessions now */ 684 clear_sta_flag(sta, WLAN_STA_BLOCK_BA); 685 686 ieee80211_sta_debugfs_add(sta); 687 rate_control_add_sta_debugfs(sta); 688 689 sinfo->generation = local->sta_generation; 690 cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL); --- 10 unchanged lines hidden (view full) --- 701 702 return 0; 703 out_remove: 704 sta_info_hash_del(local, sta); 705 list_del_rcu(&sta->list); 706 out_drop_sta: 707 local->num_sta--; 708 synchronize_net(); | 686 /* accept BA sessions now */ 687 clear_sta_flag(sta, WLAN_STA_BLOCK_BA); 688 689 ieee80211_sta_debugfs_add(sta); 690 rate_control_add_sta_debugfs(sta); 691 692 sinfo->generation = local->sta_generation; 693 cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL); --- 10 unchanged lines hidden (view full) --- 704 705 return 0; 706 out_remove: 707 sta_info_hash_del(local, sta); 708 list_del_rcu(&sta->list); 709 out_drop_sta: 710 local->num_sta--; 711 synchronize_net(); |
712 out_cleanup: |
|
709 cleanup_single_sta(sta); | 713 cleanup_single_sta(sta); |
710 out_err: | |
711 mutex_unlock(&local->sta_mtx); 712 kfree(sinfo); 713 rcu_read_lock(); 714 return err; 715} 716 717int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) 718{ --- 1884 unchanged lines hidden --- | 714 mutex_unlock(&local->sta_mtx); 715 kfree(sinfo); 716 rcu_read_lock(); 717 return err; 718} 719 720int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) 721{ --- 1884 unchanged lines hidden --- |