Patch "ath11k: fix a double free and a memory leak" has been added to the 5.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ath11k: fix a double free and a memory leak

to the 5.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ath11k-fix-a-double-free-and-a-memory-leak.patch
and it can be found in the queue-5.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 32a28eb2a0adcc34c9c27ab74a99a8e77b91cd14
Author: Tom Rix <trix@xxxxxxxxxx>
Date:   Sun Sep 6 14:26:25 2020 -0700

    ath11k: fix a double free and a memory leak
    
    [ Upstream commit 7e8453e35e406981d7c529ff8f804285bc894ba3 ]
    
    clang static analyzer reports this problem
    
    mac.c:6204:2: warning: Attempt to free released memory
            kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The channels pointer is allocated in ath11k_mac_setup_channels_rates()
    When it fails midway, it cleans up the memory it has already allocated.
    So the error handling needs to skip freeing the memory.
    
    There is a second problem.
    ath11k_mac_setup_channels_rates(), allocates 3 channels. err_free
    misses releasing ar->mac.sbands[NL80211_BAND_6GHZ].channels
    
    Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
    Signed-off-by: Tom Rix <trix@xxxxxxxxxx>
    Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20200906212625.17059-1-trix@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 2836a0f197ab0..fc5be7e8c043e 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5824,7 +5824,7 @@ static int __ath11k_mac_register(struct ath11k *ar)
 	ret = ath11k_mac_setup_channels_rates(ar,
 					      cap->supported_bands);
 	if (ret)
-		goto err_free;
+		goto err;
 
 	ath11k_mac_setup_ht_vht_cap(ar, cap, &ht_cap);
 	ath11k_mac_setup_he_cap(ar, cap);
@@ -5938,7 +5938,9 @@ static int __ath11k_mac_register(struct ath11k *ar)
 err_free:
 	kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
 	kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
+	kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
 
+err:
 	SET_IEEE80211_DEV(ar->hw, NULL);
 	return ret;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux