Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp999664yba; Thu, 4 Apr 2019 02:06:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqza/C4hraq2r9W5AIUNvkwJROqQzxZAUwEc59fROtv1RF8QR9Za3OHA+1l4BddRe//G9E8M X-Received: by 2002:a63:ed4e:: with SMTP id m14mr4783552pgk.182.1554368792549; Thu, 04 Apr 2019 02:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554368792; cv=none; d=google.com; s=arc-20160816; b=i7Kc5PfjDE4zl92tDAdvpH8rfyG/3V8StMM0HZRz6RcjFdB67pq+ysdW4VYuOe0btC z68x163Nqv163k1VYqLUzho6OzlKnwtUmBFS5EmPmaZTg4Ln9jJQLZcHgcOuVz5y0yAH az1Kr+fQK4oBHLXtRqwHteo3doHG5LoVrJQAo+r5m03S+i4HP/EPD1leNB7Y96ptSQIG B3e767alXbsVstCvrsZqofR/EsQr9vM1AzIOiGj485hwdeUsAHjI7R0Kf+S18ILFDsQ6 gVy7ogVAsOqKSeZUMrN33hipDj1sUjyHGUpEMybAYoZVxTsJ92PlQv0+RwKJfmIfTpud HVKw== 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=Py1HsDl9uabL28xIL6d8S/ldmeaoSPfXtzBJUbueuSI=; b=k+fgw7AcUKW5wn0ZL8uQdyDtlUaJOrS+1Ok2+2DS2u9IgNBJUHUTRO01AMZDDMA7Zj rSCVOl1c2aKpUjMwTJmsqpnD5/dE31ikGSxjIi7DxXWHx7BCwrobWlDEXtiS67/tLkDo 5WQTeoj97ahYpKuipX+BfPhKZtBBPL2OVncR/D6Y4ByuXuOcbgKukgmaXy9CwkgHmsRr iyfVyvq76bfq1Tx9QtQ3kt3KAssUsyxW3KY+qRpOAj6dvKBJLNvcEWhRoRz2sAEp4gpB hj2TBTVNvyUzOh8zS4YqN/xCdSxpY6+z6Euzt9ekl9/5SqdT3la8xNASHoPoMVZfzAnz 2wIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PZJKNnsI; 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 i27si13932075pgl.305.2019.04.04.02.06.17; Thu, 04 Apr 2019 02:06:32 -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=PZJKNnsI; 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 S1732150AbfDDJF2 (ORCPT + 99 others); Thu, 4 Apr 2019 05:05:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:43462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732129AbfDDJFZ (ORCPT ); Thu, 4 Apr 2019 05:05:25 -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 668352147C; Thu, 4 Apr 2019 09:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368724; bh=UfSem3mEsrv95V7lNAwIlwoaz7Ht05Zmnhkeolw+bgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZJKNnsIQcGhTkzIWuYpkDqzW5OhjappZpAkKBR9HWAsWRZGDGwo3n41bRih7i30Y pd8EpWTLOJNUbcJVkdONGrJUSREXaEiIikHis5hjbzSmPDKSTv1QWZt4OEOxU4h9H8 E3BPoj7m5KamEKwtOTVbBFLdCUDVyzqweNnOU120= 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 4.19 130/187] iwlwifi: mvm: fix RFH config command with >=10 CPUs Date: Thu, 4 Apr 2019 10:47:47 +0200 Message-Id: <20190404084609.332234205@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@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 4.19-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 16c6c7f921a8..8b7d70e3a379 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -132,13 +132,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) @@ -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); } - 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