# Re: \[PATCH\] ath: dfs\_pattern\_detector: Fix possible null-pointer dereference in channel\_detector\_create()

- From: Kalle Valo \<hidden\>
- Date: 2021-10-11 06:26:42 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/10/1537071
- Thread: https://ratatoskr.run/linux-wireless/2021/08/1468993/t.md

```text
Tuo Li [ref] wrote:

> 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 <redacted>
> Signed-off-by: Tuo Li <redacted>
> Signed-off-by: Kalle Valo <redacted>

Patch applied to ath-next branch of ath.git, thanks.

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

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210805153854.154066-1-islituo@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

```
