From: Dan Carpenter Date: Fri, 5 Sep 2025 08:02:14 +0000 (+0300) Subject: wifi: mwifiex: fix double free in mwifiex_send_rgpower_table() X-Git-Tag: v6.18-rc1~132^2~207^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3ac93e9d916ebae0711a42f524429dad89c4887;p=thirdparty%2Flinux.git wifi: mwifiex: fix double free in mwifiex_send_rgpower_table() The "hostcmd" is freed using cleanup.h, so calling kfree() will lead to a double free. Delete the kfree(). Fixes: 7b6f16a25806 ("wifi: mwifiex: add rgpower table loading support") Signed-off-by: Dan Carpenter Reviewed-by: Francesco Dolcini Link: https://patch.msgid.link/aLqZBh5_dSHUb4AE@stanley.mountain Signed-off-by: Johannes Berg --- diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index 6d9e2af29a69d..91d5098081e8b 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c @@ -1521,10 +1521,8 @@ int mwifiex_send_rgpower_table(struct mwifiex_private *priv, const u8 *data, return -ENOMEM; _data = kmemdup(data, size, GFP_KERNEL); - if (!_data) { - kfree(hostcmd); + if (!_data) return -ENOMEM; - } pos = _data; ptr = hostcmd->cmd;