This is a note to let you know that I've just added the patch titled iwlwifi: mvm: rfi: use kmemdup() to replace kzalloc + memcpy to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iwlwifi-mvm-rfi-use-kmemdup-to-replace-kzalloc-memcp.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 4493b6d6f7408e93d9bdf7ad96b61ad0c071210b Author: Bixuan Cui <cuibixuan@xxxxxxxxxxxxxxxxx> Date: Wed Oct 27 14:58:40 2021 +0800 iwlwifi: mvm: rfi: use kmemdup() to replace kzalloc + memcpy [ Upstream commit 08186e2501eec554cde8bae53b1d1de4d54abdf4 ] Fix memdup.cocci warning: ./drivers/net/wireless/intel/iwlwifi/mvm/rfi.c:110:8-15: WARNING opportunity for kmemdup Signed-off-by: Bixuan Cui <cuibixuan@xxxxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/1635317920-84725-1-git-send-email-cuibixuan@xxxxxxxxxxxxxxxxx Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx> Stable-dep-of: 06a093807eb7 ("wifi: iwlwifi: mvm: rfi: fix potential response leaks") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c index 44344216a1a90..1954b4cdb90b4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c @@ -107,12 +107,10 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm) if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size)) return ERR_PTR(-EIO); - resp = kzalloc(resp_size, GFP_KERNEL); + resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL); if (!resp) return ERR_PTR(-ENOMEM); - memcpy(resp, cmd.resp_pkt->data, resp_size); - iwl_free_resp(&cmd); return resp; }