]> git.baikalelectronics.ru Git - kernel.git/commit
mwifiex: Update virtual interface counters right after setting bss_type
authorJonas Dreßler <verdre@v0yd.nl>
Tue, 14 Sep 2021 19:59:05 +0000 (21:59 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 21 Sep 2021 15:02:17 +0000 (18:02 +0300)
commit069d046245206730227263efabeb0cac025e59d1
treea807e51d66968693a39cca7687ee8b28f125f334
parent0ede1bd220b2069ae5590f18f303d6d71ae38591
mwifiex: Update virtual interface counters right after setting bss_type

In mwifiex_init_new_priv_params() we update our private driver state to
reflect the currently selected virtual interface type. Most notably we
set the bss_mode to the mode we're going to put the firmware in.

Now after we updated the driver state we actually start talking to the
firmware and instruct it to set up the new mode. Those commands can and
will sometimes fail, in which case we return with an error from
mwifiex_change_vif_to_*. We currently update our virtual interface type
counters after this return, which means the code is never reached when a
firmware error happens and we never update the counters. Since we have
updated our bss_mode earlier though, the counters now no longer reflect
the actual state of the driver.

This will break things on the next virtual interface change, because the
virtual interface type we're switching away from didn't get its counter
incremented, and we end up decrementing a 0-counter.

To fix this, simply update the virtual interface type counters right
after updating our driver structures, so that they are always in sync.

Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210914195909.36035-6-verdre@v0yd.nl
drivers/net/wireless/marvell/mwifiex/cfg80211.c