提交 b4410c7d 编写于 作者: J Johannes Berg 提交者: Greg Kroah-Hartman

iwlwifi: mvm: fix RFH config command with >=10 CPUs

[ Upstream commit dbf592f3d14fb7d532cb7c820b1065cf33e02aaa ]

If we have >=10 (logical) CPUs, our command size exceeds the
internal buffer size and the command fails; fix that by using
IWL_HCMD_DFL_NOCOPY for the command that's allocated anyway.

While at it, also fix the leak of cmd, and use struct_size()
to calculate its size.
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
Fixes: 8edbfaa1 ("iwlwifi: mvm: configure multi RX queue")
Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 080e00c8
...@@ -132,13 +132,17 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm) ...@@ -132,13 +132,17 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
static int iwl_configure_rxq(struct iwl_mvm *mvm) static int iwl_configure_rxq(struct iwl_mvm *mvm)
{ {
int i, num_queues, size; int i, num_queues, size, ret;
struct iwl_rfh_queue_config *cmd; struct iwl_rfh_queue_config *cmd;
struct iwl_host_cmd hcmd = {
.id = WIDE_ID(DATA_PATH_GROUP, RFH_QUEUE_CONFIG_CMD),
.dataflags[0] = IWL_HCMD_DFL_NOCOPY,
};
/* Do not configure default queue, it is configured via context info */ /* Do not configure default queue, it is configured via context info */
num_queues = mvm->trans->num_rx_queues - 1; num_queues = mvm->trans->num_rx_queues - 1;
size = sizeof(*cmd) + num_queues * sizeof(struct iwl_rfh_queue_data); size = struct_size(cmd, data, num_queues);
cmd = kzalloc(size, GFP_KERNEL); cmd = kzalloc(size, GFP_KERNEL);
if (!cmd) if (!cmd)
...@@ -159,10 +163,14 @@ static int iwl_configure_rxq(struct iwl_mvm *mvm) ...@@ -159,10 +163,14 @@ static int iwl_configure_rxq(struct iwl_mvm *mvm)
cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid); cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid);
} }
return iwl_mvm_send_cmd_pdu(mvm, hcmd.data[0] = cmd;
WIDE_ID(DATA_PATH_GROUP, hcmd.len[0] = size;
RFH_QUEUE_CONFIG_CMD),
0, size, cmd); ret = iwl_mvm_send_cmd(mvm, &hcmd);
kfree(cmd);
return ret;
} }
static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm) static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册