Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4415082pxa; Mon, 10 Aug 2020 08:33:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0joHT3bkyITgbC6Bhh9mRZMrrh/tmQmKUAF1PopTiQWXsvz76NFfLHily4ai10cVJr+JB X-Received: by 2002:a05:6402:325:: with SMTP id q5mr22243225edw.343.1597073605071; Mon, 10 Aug 2020 08:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073605; cv=none; d=google.com; s=arc-20160816; b=xDGNKJyt8LcnFLG2Dn2wug3SwHt5sFOvUdQPZzp2Z2iOjwi1uVGLT4eGVomNyNEdfP wzg5sovyGzT6OOdf3G7iA9YV5i38+fw4b3xuvuapCWTLZyAGoQBCJD0HnVViKnjk9o25 USC5EWRQ8cuLpuFFNpT8wemhKuiR3vqrqx+VxcQ0GId9pP95Gyceayz924xl4tFjyGQ/ rksRyDyEhCXbNOSQxZgDVUIovpAi4Chzsm0+WtI5hbMPuyteC6y6uRgymQ149zQUILaT AospnRku6Y09rMDgfmg8zSlKtHRTbhtf5pdimsTDFNCoQkqXneAtLxRdqvzPK1u30mgP hokw== 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=IV9HoQ3chZanlhgXdu4KUxRre3WBxGPdmkF3xEygWg8=; b=bU3ZjsbERFzr11EtGaethlTfvJd6Rj+NxoQyWkREXFZrjWfC+oLbvK9qJpaWXeQySN XAzhdfkZFSnyPkG81PUs3byrabTUzv66Jm2/PaPO7rufcpqXQt8/M6liddQNDeC6gmPr x2WqnwCwzBbQWCDpz/yNhg6q+5zpuXX/VLNGrbfN3Cp15zBia9eLYj7zk+rD/OkA1PR4 9IVsZjK5s6XNpp2/eV/QtIEVxHzU9iRmv/suQHNzRHyzcUDpwppUxxoc0Sh74qBLebir nt0ZdL0u4gc5LhbVDXtTrOClEOeuSuAN0gpwEpd7/edrTzyesiI5Vlqnm5RsFnq2ZGqk ooEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KHBQ6lp/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a23si4461595edn.432.2020.08.10.08.33.02; Mon, 10 Aug 2020 08:33:25 -0700 (PDT) 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="KHBQ6lp/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729024AbgHJPcJ (ORCPT + 99 others); Mon, 10 Aug 2020 11:32:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:38012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728906AbgHJPay (ORCPT ); Mon, 10 Aug 2020 11:30:54 -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 E24B020791; Mon, 10 Aug 2020 15:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073454; bh=GdpXVV8DMlKmH9TVZ8I3srjFaDu0mJ60QwCti/S4+20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KHBQ6lp/t61vspWIyPtRIcwL0xCP9SIrYw2XdBXbfUSxnA9irHdZ5pH/Xk8B7/qKR vIF3N4ZHrtPfp1PrsTJY12CqCpezGDXRoK/l7yPlVLg7SpN7ivXL5BwCFQLqJkDyDw pBOUDEcc8sYNCHcoaxTkxkviavTGgmlSRkvs6am4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Sergey Nemov , Andrew Bowers , Jeff Kirsher , Jesse Brandeburg Subject: [PATCH 4.19 44/48] i40e: add num_vectors checker in iwarp handler Date: Mon, 10 Aug 2020 17:22:06 +0200 Message-Id: <20200810151806.389164727@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151804.199494191@linuxfoundation.org> References: <20200810151804.199494191@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Sergey Nemov [ Upstream commit 7015ca3df965378bcef072cca9cd63ed098665b5 ] 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. Fixes: e3219ce6a7754 ("i40e: Add support for client interface for IWARP driver") Signed-off-by: Sergey Nemov Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Jesse Brandeburg Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -442,6 +442,16 @@ static int i40e_config_iwarp_qvlist(stru 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 virtchnl_iwarp_qvlist_info) + (sizeof(struct virtchnl_iwarp_qv_info) * (qvlist_info->num_vectors - 1));