From patchwork Fri Sep 10 12:30:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 509152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74BF8C4332F for ; Fri, 10 Sep 2021 12:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DBC0611EE for ; Fri, 10 Sep 2021 12:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234262AbhIJMgZ (ORCPT ); Fri, 10 Sep 2021 08:36:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233342AbhIJMf1 (ORCPT ); Fri, 10 Sep 2021 08:35:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8DCB611F2; Fri, 10 Sep 2021 12:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631277256; bh=UtKDepxJnKD6aep966SvPGD5FdpgoSt7hPXJeZYRJj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4rZNdahQNWioR0LT5Wk+o6xRndJD6VX4FMSMfWzde4ZW2qgFlETuYVAG7sm7cxd9 zCN+Zovaymmov0UJ3uM+y5K8PJAC68TZvGXurZQ8Pc8TKh17txmuaZFH5a9hJN8FNa NQTwgU5HQLAkg1U/tBbjC9/LKkGvHgwFjS446yBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prabhakar Kushwaha , Ariel Elior , Shai Malin , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 10/37] qed: Fix the VF msix vectors flow Date: Fri, 10 Sep 2021 14:30:13 +0200 Message-Id: <20210910122917.519718178@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910122917.149278545@linuxfoundation.org> References: <20210910122917.149278545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Shai Malin [ Upstream commit b0cd08537db8d2fbb227cdb2e5835209db295a24 ] For VFs we should return with an error in case we didn't get the exact number of msix vectors as we requested. Not doing that will lead to a crash when starting queues for this VF. Signed-off-by: Prabhakar Kushwaha Signed-off-by: Ariel Elior Signed-off-by: Shai Malin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qed/qed_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c index bc1f5b36b5bf..1db49424aa43 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_main.c +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c @@ -559,7 +559,12 @@ static int qed_enable_msix(struct qed_dev *cdev, rc = cnt; } - if (rc > 0) { + /* For VFs, we should return with an error in case we didn't get the + * exact number of msix vectors as we requested. + * Not doing that will lead to a crash when starting queues for + * this VF. + */ + if ((IS_PF(cdev) && rc > 0) || (IS_VF(cdev) && rc == cnt)) { /* MSI-x configuration was achieved */ int_params->out.int_mode = QED_INT_MODE_MSIX; int_params->out.num_vectors = rc;