cw1200: fix missing unlock on error in cw1200_hw_scan()
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 22 Dec 2018 10:34:54 +0000 (10:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2019 17:43:44 +0000 (19:43 +0200)
commit 51c8d24101c79ffce3e79137e2cee5dfeb956dd7 upstream.

Add the missing unlock before return from function cw1200_hw_scan()
in the error handling case.

Fixes: 4f68ef64cd7f ("cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan()")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/st/cw1200/scan.c

index c5492d792f43769f5b8f0d751211c42e0947a6fd..b35f470b40ff48ea90bd3633831524d34d8429e3 100644 (file)
@@ -84,8 +84,11 @@ int cw1200_hw_scan(struct ieee80211_hw *hw,
 
        frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0,
                req->ie_len);
-       if (!frame.skb)
+       if (!frame.skb) {
+               mutex_unlock(&priv->conf_mutex);
+               up(&priv->scan.lock);
                return -ENOMEM;
+       }
 
        if (req->ie_len)
                memcpy(skb_put(frame.skb, req->ie_len), req->ie, req->ie_len);