From: Li Qiang Date: Fri, 17 Oct 2025 04:11:28 +0000 (+0800) Subject: wifi: iwlwifi: mld: add null check for kzalloc() in iwl_mld_send_proto_offload() X-Git-Tag: v6.19-rc1~170^2~227^2~1^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3df28496673bd8009f1cd3a85a63650c96e369f4;p=thirdparty%2Flinux.git wifi: iwlwifi: mld: add null check for kzalloc() in iwl_mld_send_proto_offload() Add a missing NULL pointer check after kzalloc() in iwl_mld_send_proto_offload(). Without this check, a failed allocation could lead to a NULL dereference. Fixes: d1e879ec600f9 ("wifi: iwlwifi: add iwlmld sub-driver") Signed-off-by: Li Qiang Link: https://patch.msgid.link/20251017041128.1379715-1-liqiang01@kylinos.cn Signed-off-by: Miri Korenblit --- diff --git a/drivers/net/wireless/intel/iwlwifi/mld/d3.c b/drivers/net/wireless/intel/iwlwifi/mld/d3.c index 1d4282a21f09e..dd85be94433cc 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/d3.c @@ -1794,6 +1794,10 @@ iwl_mld_send_proto_offload(struct iwl_mld *mld, u32 enabled = 0; cmd = kzalloc(hcmd.len[0], GFP_KERNEL); + if (!cmd) { + IWL_DEBUG_WOWLAN(mld, "Failed to allocate proto offload cmd\n"); + return -ENOMEM; + } #if IS_ENABLED(CONFIG_IPV6) struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);