[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c82d9d47-9c4b-4af9-a1e8-7c975b53fe30@quicinc.com>
Date: Mon, 25 Sep 2023 11:46:02 -0700
From: Jeff Johnson <quic_jjohnson@...cinc.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Kalle Valo <kvalo@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>,
"Kalle Valo" <quic_kvalo@...cinc.com>,
<linux-wireless@...r.kernel.org>
Subject: Re: [PATCH wireless 1/2] ath: dfs_pattern_detector: Fix a memory
initialization issue
On 9/23/2023 11:57 PM, Christophe JAILLET wrote:
> If an error occurs and channel_detector_exit() is called, it relies on
> entries of the 'detectors' array to be NULL.
> Otherwise, it may access to un-initialized memory.
>
> Fix it and initialize the memory, as what was done before the commit in
> Fixes.
>
> Fixes: a063b650ce5d ("ath: dfs_pattern_detector: Avoid open coded arithmetic in memory allocation")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> Patch #1/2 is a fix, for for wireless.
> Patch #2/2 is for wireless-next I guess, but depnds on #1
>
> Not sure if we can mix different target in the same serie. Let me know.
>
> BTW, sorry for messing up things with a063b650ce5d :(
> ---
> drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c
> index 27f4d74a41c8..2788a1b06c17 100644
> --- a/drivers/net/wireless/ath/dfs_pattern_detector.c
> +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
> @@ -206,7 +206,7 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq)
>
> INIT_LIST_HEAD(&cd->head);
> cd->freq = freq;
> - cd->detectors = kmalloc_array(dpd->num_radar_types,
> + cd->detectors = kcalloc(dpd->num_radar_types,
> sizeof(*cd->detectors), GFP_ATOMIC);
nit: align descendant on (
> if (cd->detectors == NULL)
> goto fail;
Powered by blists - more mailing lists