.. | .. |
---|
796 | 796 | u8 *next; |
---|
797 | 797 | |
---|
798 | 798 | if (params->bss) { |
---|
799 | | - /* Make sure the bss entry provided by the driver is valid. */ |
---|
800 | 799 | struct cfg80211_internal_bss *ibss = bss_from_pub(params->bss); |
---|
801 | 800 | |
---|
802 | | - if (WARN_ON(list_empty(&ibss->list))) { |
---|
803 | | - cfg80211_put_bss(wdev->wiphy, params->bss); |
---|
804 | | - return; |
---|
| 801 | + if (list_empty(&ibss->list)) { |
---|
| 802 | + struct cfg80211_bss *found = NULL, *tmp = params->bss; |
---|
| 803 | + |
---|
| 804 | + found = cfg80211_get_bss(wdev->wiphy, NULL, |
---|
| 805 | + params->bss->bssid, |
---|
| 806 | + wdev->ssid, wdev->ssid_len, |
---|
| 807 | + wdev->conn_bss_type, |
---|
| 808 | + IEEE80211_PRIVACY_ANY); |
---|
| 809 | + if (found) { |
---|
| 810 | + /* The same BSS is already updated so use it |
---|
| 811 | + * instead, as it has latest info. |
---|
| 812 | + */ |
---|
| 813 | + params->bss = found; |
---|
| 814 | + } else { |
---|
| 815 | + /* Update with BSS provided by driver, it will |
---|
| 816 | + * be freshly added and ref cnted, we can free |
---|
| 817 | + * the old one. |
---|
| 818 | + * |
---|
| 819 | + * signal_valid can be false, as we are not |
---|
| 820 | + * expecting the BSS to be found. |
---|
| 821 | + * |
---|
| 822 | + * keep the old timestamp to avoid confusion |
---|
| 823 | + */ |
---|
| 824 | + cfg80211_bss_update(rdev, ibss, false, |
---|
| 825 | + ibss->ts); |
---|
| 826 | + } |
---|
| 827 | + |
---|
| 828 | + cfg80211_put_bss(wdev->wiphy, tmp); |
---|
805 | 829 | } |
---|
806 | 830 | } |
---|
807 | 831 | |
---|