linux/drivers/net/wireless
Matteo Croce 1478e902bc virt_wifi: fix error on connect
[ Upstream commit 17109e9783 ]

When connecting without first doing a scan, the BSS list is empty
and __cfg80211_connect_result() generates this warning:

$ iw dev wlan0 connect -w VirtWifi
[   15.371989] ------------[ cut here ]------------
[   15.372179] WARNING: CPU: 0 PID: 92 at net/wireless/sme.c:756 __cfg80211_connect_result+0x402/0x440
[   15.372383] CPU: 0 PID: 92 Comm: kworker/u2:2 Not tainted 5.13.0-kvm #444
[   15.372512] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-3.fc34 04/01/2014
[   15.372597] Workqueue: cfg80211 cfg80211_event_work
[   15.372756] RIP: 0010:__cfg80211_connect_result+0x402/0x440
[   15.372818] Code: 48 2b 04 25 28 00 00 00 75 59 48 8b 3b 48 8b 76 10 48 8d 65 e0 5b 41 5c 41 5d 41 5e 5d 49 8d 65 f0 41 5d e9 d0 d4 fd ff 0f 0b <0f> 0b e9 f6 fd ff ff e8 f2 4a b4 ff e9 ec fd ff ff 0f 0b e9 19 fd
[   15.372966] RSP: 0018:ffffc900005cbdc0 EFLAGS: 00010246
[   15.373022] RAX: 0000000000000000 RBX: ffff8880028e2400 RCX: ffff8880028e2472
[   15.373088] RDX: 0000000000000002 RSI: 00000000fffffe01 RDI: ffffffff815335ba
[   15.373149] RBP: ffffc900005cbe00 R08: 0000000000000008 R09: ffff888002bdf8b8
[   15.373209] R10: ffff88803ec208f0 R11: ffffffffffffe9ae R12: ffff88801d687d98
[   15.373280] R13: ffff88801b5fe000 R14: ffffc900005cbdc0 R15: dead000000000100
[   15.373330] FS:  0000000000000000(0000) GS:ffff88803ec00000(0000) knlGS:0000000000000000
[   15.373382] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   15.373425] CR2: 000056421c468958 CR3: 000000001b458001 CR4: 0000000000170eb0
[   15.373478] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   15.373529] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   15.373580] Call Trace:
[   15.373611]  ? cfg80211_process_wdev_events+0x10e/0x170
[   15.373743]  cfg80211_process_wdev_events+0x10e/0x170
[   15.373783]  cfg80211_process_rdev_events+0x21/0x40
[   15.373846]  cfg80211_event_work+0x20/0x30
[   15.373892]  process_one_work+0x1e9/0x340
[   15.373956]  worker_thread+0x4b/0x3f0
[   15.374017]  ? process_one_work+0x340/0x340
[   15.374053]  kthread+0x11f/0x140
[   15.374089]  ? set_kthread_struct+0x30/0x30
[   15.374153]  ret_from_fork+0x1f/0x30
[   15.374187] ---[ end trace 321ef0cb7e9c0be1 ]---
wlan0 (phy #0): connected to 00:00:00:00:00:00

Add the fake bss just before the connect so that cfg80211_get_bss()
finds the virtual network.
As some code was duplicated, move it in a common function.

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
Link: https://lore.kernel.org/r/20210706154423.11065-1-mcroce@linux.microsoft.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2021-08-12 13:22:20 +02:00
..
admtek adm8211: fix error return code in adm8211_probe() 2020-12-30 11:53:40 +01:00
ath ath11k: unlock on error path in ath11k_mac_op_add_interface() 2021-07-19 09:44:55 +02:00
atmel atmel: convert tasklets to use new tasklet_setup() API 2020-08-27 16:22:02 +03:00
broadcom brcmsmac: mac80211_if: Fix a resource leak in an error handling path 2021-07-14 16:56:21 +02:00
cisco airo: work around stack usage warning 2021-05-22 11:40:51 +02:00
intel iwlwifi: pcie: fix context info freeing 2021-07-19 09:44:52 +02:00
intersil orinoco: Move context allocation after processing the skb 2020-12-30 11:53:21 +01:00
marvell mwifiex: re-fix for unaligned accesses 2021-07-14 16:56:34 +02:00
mediatek mt76: mt7915: fix IEEE80211_HE_PHY_CAP7_MAX_NC for station mode 2021-07-19 09:44:51 +02:00
microchip wilc1000: write value to WILC_INTR2_ENABLE register 2021-05-14 09:50:29 +02:00
quantenna qtnfmac: Fix possible buffer overflow in qtnf_event_handle_external_auth 2021-05-19 10:12:58 +02:00
ralink rt2x00: convert tasklets to use new tasklet_setup() API 2020-08-27 16:22:13 +03:00
realtek rtl8xxxu: Fix device info for RTL8192EU devices 2021-07-19 09:44:51 +02:00
rsi rsi: fix AP mode with WPA failure due to encrypted EAPOL 2021-07-14 16:55:46 +02:00
st cw1200: add missing MODULE_DEVICE_TABLE 2021-07-19 09:44:50 +02:00
ti wl1251: Fix possible buffer overflow in wl1251_cmd_scan 2021-07-19 09:44:50 +02:00
zydas net: zd1211rw: Remove ZD_ASSERT(in_interrupt()) 2020-09-29 14:02:54 -07:00
Kconfig wireless-drivers-next patches for v5.9 2020-07-20 17:52:50 -07:00
mac80211_hwsim.c mac80211_hwsim: add concurrent channels scanning support over virtio 2021-07-19 09:44:53 +02:00
mac80211_hwsim.h mac80211_hwsim: notify wmediumd of used MAC addresses 2020-04-24 11:45:47 +02:00
Makefile wilc1000: move wilc driver out of staging 2020-06-26 08:46:46 +03:00
ray_cs.c ray_cs: use true,false for bool variable 2020-05-06 11:33:23 +03:00
ray_cs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rayctl.h ray_cs: Replace zero-length array with flexible-array member 2020-03-23 19:18:27 +02:00
rndis_wlan.c rndis_wlan: tighten check of rndis_query_oid return 2020-08-18 15:52:45 +03:00
virt_wifi.c virt_wifi: fix error on connect 2021-08-12 13:22:20 +02:00
wl3501.h wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join 2021-05-19 10:12:58 +02:00
wl3501_cs.c wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join 2021-05-19 10:12:58 +02:00