Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1007174yba; Thu, 4 Apr 2019 02:16:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAykFoML+IZhvBM6HVVAVctcToXb7+OH0HOLiw/wN3IxC5PzjTp/IQr//kPEUzVSDmI187 X-Received: by 2002:a17:902:2a29:: with SMTP id i38mr5297478plb.22.1554369385880; Thu, 04 Apr 2019 02:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554369385; cv=none; d=google.com; s=arc-20160816; b=YembaCK22JIAwMu9md4FkLbMXg4aAcb+5Ose+pYGcGNqN/SRJrN9tOomoRdDUA6ugO 5gjn/EbR2qFEElLnV+v56kbfBC+3Y6CiyMuLm/3pBRdSSYRz4MDC0pKRgfnf7SsCv2sf y00/C/h0ruFJZsdm69u5i2n8JZ0duKJchB45EZ9qUMckf9CEZApH/ECEiQbA4XZ4leKt vqllNr0mqMq2Fwa/HehbPEDGFGIhAuDk/RvFWVtmqEXEk3DX8IaUMGzFVjbfwmgSa1Hz FQROU/x3HboXOIpE7wziV7FQSm4fUibjLsc76/XPAn/QD7tOPu4luatmGjdtifFouLNU 16oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J+EhjmHuBzabNE/0owX2MhFVV/wi7V2OGuGjk8hzK5U=; b=Qv+uuqv66HaKK09NTfSiv8u+X6qWfpqizdyOz9DCjb0kdQX61oS3FoNvoZmGkSrNhr Qx5S2aXdSB2OcWLr+buJ9mK+306NPDiWf5K3yxpDLO2xO5VIOPeLpgJAOxds/YO+ECfv P56kMYOr+IDSKpqqx8GQYcdkFqb6CjZoqtDyscGKTTx52jWh/llIO/GLHieValARzxbO uY62HDE8An2LnxrRFvRfvFhqLP0iwwVwA87T+r8dQD/3M9YFlREliYljCLPBFiR58Rjg oIqcNMJFuwbLD7K1ZBYUC1ILgaTXABwybNLMZFn4FMYUkh/Lw+UDj2MOEZ5Ex4jY+6R7 FLrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tGOhYin5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n79si16090119pfb.133.2019.04.04.02.16.10; Thu, 04 Apr 2019 02:16:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tGOhYin5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387506AbfDDJPg (ORCPT + 99 others); Thu, 4 Apr 2019 05:15:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:56602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387905AbfDDJPf (ORCPT ); Thu, 4 Apr 2019 05:15:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F116B20652; Thu, 4 Apr 2019 09:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554369334; bh=faWqncdwXJ9NdJmPyWpuyMLENj8IbH3pi9SV7e30S8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tGOhYin5hVHwy5kiz6KO6xS3NUIgrSx96w8CLJXxnPyNh6hDyBvZsP47CpUfBCmDO 54AhUvF3xYAO44TZGqoUL1Lx4fS6TVGXjNO7mXs8/zrkhpw2NUSr8y4t04ffAsDwhk 9KRe8pBxC9fG5TWBMpDzJ9kdieZRJ7xXH9fKinKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.0 172/246] iwlwifi: mvm: fix RFH config command with >=10 CPUs Date: Thu, 4 Apr 2019 10:47:52 +0200 Message-Id: <20190404084625.198752486@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084619.236418459@linuxfoundation.org> References: <20190404084619.236418459@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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: Johannes Berg Fixes: 8edbfaa19835 ("iwlwifi: mvm: configure multi RX queue") Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 0d6c313b6669..19ec55cef802 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -127,13 +127,17 @@ static int iwl_send_rss_cfg_cmd(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_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 */ 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); if (!cmd) @@ -154,10 +158,14 @@ static int iwl_configure_rxq(struct iwl_mvm *mvm) cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid); } - return iwl_mvm_send_cmd_pdu(mvm, - WIDE_ID(DATA_PATH_GROUP, - RFH_QUEUE_CONFIG_CMD), - 0, size, cmd); + hcmd.data[0] = cmd; + hcmd.len[0] = size; + + ret = iwl_mvm_send_cmd(mvm, &hcmd); + + kfree(cmd); + + return ret; } static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm) -- 2.19.1