From: Dan Carpenter <dan.carpenter@linaro.org>
To: Qianfeng Rong <rongqianfeng@vivo.com>
Cc: Brian Norris <briannorris@chromium.org>,
Francesco Dolcini <francesco@dolcini.it>,
Johannes Berg <johannes.berg@intel.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Kalle Valo <kvalo@kernel.org>,
Aditya Kumar Singh <quic_adisi@quicinc.com>,
Roopni Devanathan <quic_rdevanat@quicinc.com>,
Rameshkumar Sundaram <quic_ramess@quicinc.com>,
Jason Xing <kerneljasonxing@gmail.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Thomas Gleixner <tglx@linutronix.de>,
Jeff Chen <jeff.chen_1@nxp.con>,
Bert Karwatzki <spasswolf@web.de>,
Jinjie Ruan <ruanjinjie@huawei.com>,
"John W. Linville" <linville@tuxdriver.com>,
Cathy Luo <cluo@marvell.com>, Xinmin Hu <huxm@marvell.com>,
Avinash Patil <patila@marvell.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] wifi: mwifiex: use kcalloc to apply for chan_stats
Date: Thu, 14 Aug 2025 17:50:36 +0300 [thread overview]
Message-ID: <aJ33vFdOfMRDbpls@stanley.mountain> (raw)
In-Reply-To: <20250814131536.231945-1-rongqianfeng@vivo.com>
On Thu, Aug 14, 2025 at 09:15:31PM +0800, Qianfeng Rong wrote:
> Use kcalloc to allocate 'adapter->chan_stats' memory (max 900 bytes)
> instead of vmalloc for efficiency and zero-initialize it for security
> per Dan Carpenter's suggestion.
>
This patch is okay, but lets re-write the commit message:
Subject: wifi: mwifiex: Initialize the chan_stats array to zero
The adapter->chan_stats[] array is initialized in
mwifiex_init_channel_scan_gap() with vmalloc(), which doesn't zero out
memory. The array is filled in mwifiex_update_chan_statistics()
and then the user can query the data in mwifiex_cfg80211_dump_survey().
There are two potential issues here. What if the user calls
mwifiex_cfg80211_dump_survey() before the data has been filled in.
Also the mwifiex_update_chan_statistics() function doesn't necessarily
initialize the whole array. Since the array was not initialized at
the start that could result in an information leak.
Also this array is pretty small. It's a maximum of 900 bytes so it's
more appropriate to use kcalloc() instead vmalloc().
regards,
dan carpenter
next prev parent reply other threads:[~2025-08-14 14:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 13:15 [PATCH v2] wifi: mwifiex: use kcalloc to apply for chan_stats Qianfeng Rong
2025-08-14 14:33 ` Markus Elfring
2025-08-25 8:04 ` Johannes Berg
2025-08-14 14:50 ` Dan Carpenter [this message]
2025-08-15 2:06 ` Qianfeng Rong
2025-08-15 9:28 ` [v2] " Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aJ33vFdOfMRDbpls@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=briannorris@chromium.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=cluo@marvell.com \
--cc=francesco@dolcini.it \
--cc=huxm@marvell.com \
--cc=jeff.chen_1@nxp.con \
--cc=johannes.berg@intel.com \
--cc=kerneljasonxing@gmail.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=patila@marvell.com \
--cc=quic_adisi@quicinc.com \
--cc=quic_ramess@quicinc.com \
--cc=quic_rdevanat@quicinc.com \
--cc=rongqianfeng@vivo.com \
--cc=ruanjinjie@huawei.com \
--cc=s.hauer@pengutronix.de \
--cc=spasswolf@web.de \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.