Re: [PATCH v9 2/2] wifi: mwifiex: add host mlme for AP mode

From: Brian Norris
Date: Fri Mar 15 2024 - 20:45:29 EST


On Wed, Mar 06, 2024 at 10:00:53AM +0800, David Lin wrote:
> Add host based MLME to enable WPA3 functionalities in AP mode.
> This feature required a firmware with the corresponding V2 Key API
> support. The feature (WPA3) is currently enabled and verified only
> on IW416. Also, verified no regression with change when host MLME
> is disabled.
>
> Signed-off-by: David Lin <yu-hao.lin@xxxxxxx>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@xxxxxxxxxxx>

Quick pass for now; nothing jumps out at me today, but I'll give a
better look/Ack next week:

> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c


> @@ -3951,12 +3974,43 @@ mwifiex_cfg80211_tdls_cancel_chan_switch(struct wiphy *wiphy,
> }
> }
>
> +static int
> +mwifiex_cfg80211_uap_add_station(struct mwifiex_private *priv, const u8 *mac,
> + struct station_parameters *params)
> +{
> + struct mwifiex_sta_info add_sta;
> + int ret;
> +
> + memcpy(add_sta.peer_mac, mac, ETH_ALEN);
> + add_sta.params = params;
> +
> + ret = mwifiex_send_cmd(priv, HostCmd_CMD_ADD_NEW_STATION,
> + HostCmd_ACT_ADD_STA, 0, (void *)&add_sta, true);
> +
> + if (!ret) {
> + struct station_info *sinfo;
> +
> + sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL);

Couldn't this just be stack allocation?

struct staion_info sinfo;

cfg80211_new_sta(priv->netdev, mac, &sinfo, GFP_KERNEL);

I'm not sure you need to kzalloc() something here, if you're freeing it
a few lines later.


> + if (!sinfo)
> + return -ENOMEM;
> +
> + cfg80211_new_sta(priv->netdev, mac, sinfo, GFP_KERNEL);
> + kfree(sinfo);
> + }
> +
> + return ret;
> +}

Brian