[PATCH 4.9 042/116] mwifiex: fix unbalanced locking in mwifiex_process_country_ie()

From: Greg Kroah-Hartman
Date: Thu Feb 13 2020 - 11:05:37 EST


From: Brian Norris <briannorris@xxxxxxxxxxxx>

commit 65b1aae0d9d5962faccc06bdb8e91a2a0b09451c upstream.

We called rcu_read_lock(), so we need to call rcu_read_unlock() before
we return.

Fixes: 3d94a4a8373b ("mwifiex: fix possible heap overflow in mwifiex_process_country_ie()")
Cc: stable@xxxxxxxxxxxxxxx
Cc: huangwen <huangwenabc@xxxxxxxxx>
Cc: Ganapathi Bhat <ganapathi.bhat@xxxxxxx>
Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
Acked-by: Ganapathi Bhat <ganapathi.bhat@xxxxxxx>
Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -274,6 +274,7 @@ static int mwifiex_process_country_ie(st

if (country_ie_len >
(IEEE80211_COUNTRY_STRING_LEN + MWIFIEX_MAX_TRIPLET_802_11D)) {
+ rcu_read_unlock();
mwifiex_dbg(priv->adapter, ERROR,
"11D: country_ie_len overflow!, deauth AP\n");
return -EINVAL;