From: Ping-Ke Shih <pkshih@realtek.com>
To: "Ondřej Jirman" <megi@xff.cz>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2 2/2] wifi: rtw89: Fix inadverent sharing of struct ieee80211_supported_band data
Date: Tue, 29 Apr 2025 06:37:26 +0000 [thread overview]
Message-ID: <91c53b3583864650a48de2ffa0dfccd1@realtek.com> (raw)
In-Reply-To: <20250429022046.1656056-3-megi@xff.cz>
Ondřej Jirman <megi@xff.cz> wrote:
> Internally wiphy writes to individual channels in this structure,
> so we must not share one static definition of channel list between
> multiple device instances, because that causes hard to debug
> breakage.
>
> For example, with two rtw89 driven devices in the system, channel
> information may get incoherent, preventing channel use.
>
> Signed-off-by: Ondrej Jirman <megi@xff.cz>
> ---
> drivers/net/wireless/realtek/rtw89/core.c | 33 +++++++++++++++++++----
> 1 file changed, 28 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index b164bc767e82..48e21a3549ff 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -4400,17 +4400,40 @@ static int rtw89_init_he_eht_cap(struct rtw89_dev *rtwdev,
> return 0;
> }
>
> +static struct ieee80211_supported_band *
> +rtw89_core_sband_dup(struct rtw89_dev *rtwdev,
> + const struct ieee80211_supported_band *sband)
> +{
> + struct ieee80211_supported_band *dup;
> +
> + dup = devm_kmemdup(rtwdev->dev, sband, sizeof(*sband), GFP_KERNEL);
> + if (!dup)
> + return NULL;
> +
> + dup->channels = devm_kmemdup(rtwdev->dev, sband->channels,
> + sizeof(struct ieee80211_channel) * sband->n_channels,
sizeof(*sband->channels) * sband->n_channels,
> + GFP_KERNEL);
> + if (!dup->channels)
> + return NULL;
> +
> + dup->bitrates = devm_kmemdup(rtwdev->dev, sband->bitrates,
> + sizeof(struct ieee80211_rate) * sband->n_bitrates,
sizeof(*sband->bitrates) * sband->n_bitrates,
> + GFP_KERNEL);
> + if (!dup->bitrates)
> + return NULL;
> +
> + return dup;
> +}
> +
[...]
next prev parent reply other threads:[~2025-04-29 6:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 2:20 [PATCH v2 0/2] Fix inadverent sharing of struct ieee80211_supported_band data Ondřej Jirman
2025-04-29 2:20 ` [PATCH v2 1/2] wifi: rtw89: Convert rtw89_core_set_supported_band to use devm_* Ondřej Jirman
2025-04-29 6:27 ` Ping-Ke Shih
2025-04-29 2:20 ` [PATCH v2 2/2] wifi: rtw89: Fix inadverent sharing of struct ieee80211_supported_band data Ondřej Jirman
2025-04-29 6:37 ` Ping-Ke Shih [this message]
2025-04-29 6:16 ` [PATCH v2 0/2] " Ping-Ke Shih
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=91c53b3583864650a48de2ffa0dfccd1@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=megi@xff.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).