Patch "ath: dfs_pattern_detector: Fix possible null-pointer dereference in channel_detector_create()" has been added to the 4.14-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

    ath: dfs_pattern_detector: Fix possible null-pointer dereference in channel_detector_create()

to the 4.14-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:
     ath-dfs_pattern_detector-fix-possible-null-pointer-d.patch
and it can be found in the queue-4.14 subdirectory.

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



commit b4a2369ee5920020c261b81b7fd7333361e8d9b6
Author: Tuo Li <islituo@xxxxxxxxx>
Date:   Thu Aug 5 08:38:53 2021 -0700

    ath: dfs_pattern_detector: Fix possible null-pointer dereference in channel_detector_create()
    
    [ Upstream commit 4b6012a7830b813799a7faf40daa02a837e0fd5b ]
    
    kzalloc() is used to allocate memory for cd->detectors, and if it fails,
    channel_detector_exit() behind the label fail will be called:
      channel_detector_exit(dpd, cd);
    
    In channel_detector_exit(), cd->detectors is dereferenced through:
      struct pri_detector *de = cd->detectors[i];
    
    To fix this possible null-pointer dereference, check cd->detectors before
    the for loop to dereference cd->detectors.
    
    Reported-by: TOTE Robot <oslab@xxxxxxxxxxxxxxx>
    Signed-off-by: Tuo Li <islituo@xxxxxxxxx>
    Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210805153854.154066-1-islituo@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c
index 78146607f16e8..acd85e5069346 100644
--- a/drivers/net/wireless/ath/dfs_pattern_detector.c
+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
@@ -182,10 +182,12 @@ static void channel_detector_exit(struct dfs_pattern_detector *dpd,
 	if (cd == NULL)
 		return;
 	list_del(&cd->head);
-	for (i = 0; i < dpd->num_radar_types; i++) {
-		struct pri_detector *de = cd->detectors[i];
-		if (de != NULL)
-			de->exit(de);
+	if (cd->detectors) {
+		for (i = 0; i < dpd->num_radar_types; i++) {
+			struct pri_detector *de = cd->detectors[i];
+			if (de != NULL)
+				de->exit(de);
+		}
 	}
 	kfree(cd->detectors);
 	kfree(cd);



[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