Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3882153pxb; Tue, 17 Nov 2020 06:07:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzt7B7ObLdKfGbvq74mSUPPqY4pttfXFzQ25atNCcCl6ZusjmCImQP7513vOJEhF72yknPn X-Received: by 2002:a17:906:5c43:: with SMTP id c3mr21107377ejr.390.1605622074679; Tue, 17 Nov 2020 06:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605622074; cv=none; d=google.com; s=arc-20160816; b=kHntHDp0seZQmlC0uBP/OHdCLQdcQNuNwifPqXzTfZwkga27w8jMrhX+rKxYfkW4P2 XpN8Z7kIDyzxElsAlCulKhmgR6Uv4WxdTWCuU6JF5wZWEJUyIRreB4xZDyrhRU036bUK PpoEF8qLQNoftkusFky+ra+UOoDe0eKrz69VrXqETG8pE1XrIe4ooLbnJ+nMDNZoM2ew P5WySm9js8Jcub+FQcEWlzxFNmOoinE6EkP8S0Om1m6CT5OIDwvtxLsGImDU8umz2OIR hI1qycoEuriB2n0oewPuamXdHOABrO2VYThuw7W+HHkVe8cSBFX1pYxpFgjro6NSr/KC 9ydg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wjo92j6CDTvtwYM4ZpQIpYo8r+rj8y3rGDvRhGKpS68=; b=cI5766lrDfoUGPqLMZ9FDxGzsQmRgptZswo1qTs9lh4jriIuA8kQPqrJY85nlNZlOe 8Ydu0Z8uICD8zaR7Z3W2Fr1RwDdoehSXI34YnpeMjOtsRMZVIC9wVPwmAFY446niA9Ga gOoKbo+TmJke/ZEGnznn/fiRoLvxqA3DSwXsO28nrwbWvbLVN/KPJn53c4WLwz0kypwo pZxvBfI0OBwVWYhlETjnNt9EAkFRTOHMKw+vOaERc9Yr1WPPEbVRTFK7s01LsMOd7hoR WlRkwneNuA9YKwCgTbRA/Zea7s2Ve1RIlpNeNzCaHcBKm+uEeLAdXsa9EP65t7aHY9fh LmMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f6eS9R3q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si5078321ejb.73.2020.11.17.06.07.23; Tue, 17 Nov 2020 06:07:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f6eS9R3q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731204AbgKQOEp (ORCPT + 99 others); Tue, 17 Nov 2020 09:04:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:39060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728942AbgKQNJy (ORCPT ); Tue, 17 Nov 2020 08:09:54 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 161EE24698; Tue, 17 Nov 2020 13:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618593; bh=QEBM97sDOsOYGVJv2sJ0AfHyKIxvJh92X0hN957cl6c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6eS9R3qrIEI5pBT7Wl6ThyeBKAXat5pLihBndypuRdx2PaOjOUXQEvIM2AHjNF9e v/GCMyUMM8+i828y0cJCdcwqeuW9xHVoAhHLo2O2CIEcbi7qT7Dtum2tZOmXMoOIOf x57mT5wYYyY8KQ4TDRqbagELBiLPAgaPxeQxtgWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Nemov , Andrew Bowers , Jeff Kirsher , Ben Hutchings , Sasha Levin Subject: [PATCH 4.9 20/78] i40e: add num_vectors checker in iwarp handler Date: Tue, 17 Nov 2020 14:04:46 +0100 Message-Id: <20201117122110.095164212@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122109.116890262@linuxfoundation.org> References: <20201117122109.116890262@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Nemov commit 7015ca3df965378bcef072cca9cd63ed098665b5 upstream. Field num_vectors from struct virtchnl_iwarp_qvlist_info should not be larger than num_msix_vectors_vf in the hw struct. The iwarp uses the same set of vectors as the LAN VF driver. Signed-off-by: Sergey Nemov Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher [bwh: Backported to 4.9: adjust context] Signed-off-by: Ben Hutchings Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 0f54269ffc463..0ac09c9e4aaac 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -418,6 +418,16 @@ static int i40e_config_iwarp_qvlist(struct i40e_vf *vf, u32 next_q_idx, next_q_type; u32 msix_vf, size; + msix_vf = pf->hw.func_caps.num_msix_vectors_vf; + + if (qvlist_info->num_vectors > msix_vf) { + dev_warn(&pf->pdev->dev, + "Incorrect number of iwarp vectors %u. Maximum %u allowed.\n", + qvlist_info->num_vectors, + msix_vf); + goto err; + } + size = sizeof(struct i40e_virtchnl_iwarp_qvlist_info) + (sizeof(struct i40e_virtchnl_iwarp_qv_info) * (qvlist_info->num_vectors - 1)); -- 2.27.0