Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3299837ybb; Tue, 31 Mar 2020 02:24:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtk8c10NAr9Mf+pM4pPUdU9TZ9qb9iCPbc0xIX+wDh5rwQu1t1xc1coWmd7QotHKujpl+UL X-Received: by 2002:a05:6830:1f54:: with SMTP id u20mr12607098oth.322.1585646662814; Tue, 31 Mar 2020 02:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585646662; cv=none; d=google.com; s=arc-20160816; b=ZqWLKzCYU5qdo224HDVY799uE4IyWzBPTFzHp/P6POAVB4HYZzSOmvEjaoAzv7tiJz 8YVmA3sJZIWaWri4NKLCsR/Nc+3kPBQ1XVnee5sSLppUjyoNAQd0iFCmewJPYJfRPe+9 18YgsDjQianAYlGaeVGgb6ETnKJEhq8FbZx/JQvbziqt9PxY82OrAk+YNIZlX0je6R4/ //xzRvlFn/CwxrNSmQAVpvMLpPWZT2XW9FTyJrask0fKo05aRKnWIFZ850XNfZjCKOGs lvMUkTCVhXqvyzuvh4P4fiDAmp38yf1t1fONLAiXmQUyh5zhPlq22FLGqEYh7M3G6gmw 4POA== 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=TVtQph7i2NAEZfe8IAxRy1ya2DUNEfYDM0RayFq0Goo=; b=kYpEgLwiccPRhB+cviIhMW0NU6TKkeyE4Or7E8abrsO/9ml6RkwwziWufp9SidyJGY lDvIH1qmenKFaEihUhT7QxRDpbGl+E7OJXEV3alkII35vVBeT+zheddZpe775t/u2uhw Yy098roR0MzJkdMsajg+NdNqh+1xSYsyYsXdXe8IbUXw9mdJ3LsIMCtHfSAHnSGibh7K /+zZY5NE6r7HuN9OvtDRj2jhjj+togZ/A7D9dPHKPWzALqqZICKMjSfxVbCB6p6ruOb0 RjKW8bnIwwpvj6VcCFYoDFtm322WKWZv5HzXJh1lFmlKnA8dKNcD/DRcC3BLHc2Qt01z z2CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wgkYENoC; 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 b19si9708472ots.224.2020.03.31.02.24.10; Tue, 31 Mar 2020 02:24:22 -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=wgkYENoC; 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 S1730851AbgCaJDm (ORCPT + 99 others); Tue, 31 Mar 2020 05:03:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:43426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730616AbgCaJDk (ORCPT ); Tue, 31 Mar 2020 05:03:40 -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 28A6220787; Tue, 31 Mar 2020 09:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645419; bh=Zf31paX7k2ZkrtIcuW+qjbnpvFLPskIxAlURiEL6dX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wgkYENoCXgtCMTaClTb9z/G6PHFkGIvhRSpJgoheJYb11J7vo64W1cYIZpi+2KzBy rbSu4PDifiifQfyrDEUUwdKMiUD+p2QuaL/ZVL8y20Z5nCoT8tKrZ4l2SYeti0TcHe uCoMCYuKAKt7wjId3hf4CXROwvoxozXfkMdVSSzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sameeh Jubran , Arthur Kiyanovski , "David S. Miller" Subject: [PATCH 5.5 047/170] net: ena: fix incorrect setting of the number of msix vectors Date: Tue, 31 Mar 2020 10:57:41 +0200 Message-Id: <20200331085429.420618706@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@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: Arthur Kiyanovski [ Upstream commit ce1f352162828ba07470328828a32f47aa759020 ] Overview: We don't frequently change the msix vectors throughout the life cycle of the driver. We do so in two functions: ena_probe() and ena_restore(). ena_probe() is only called when the driver is loaded. ena_restore() on the other hand is called during device reset / resume operations. We use num_io_queues for calculating and allocating the number of msix vectors. At ena_probe() this value is equal to max_num_io_queues and thus this is not an issue, however ena_restore() might be called after the number of io queues has changed. A possible bug scenario is as follows: * Change number of queues from 8 to 4. (num_io_queues = 4, max_num_io_queues = 8, msix_vecs = 9,) * Trigger reset occurs -> ena_restore is called. (num_io_queues = 4, max_num_io_queues =8 , msix_vecs = 5) * Change number of queues from 4 to 6. (num_io_queues = 6, max_num_io_queues = 8, msix_vecs = 5) * The driver will reset due to failure of check_for_rx_interrupt_queue() Fix: This can be easily fixed by always using max_num_io_queues to init the msix_vecs, since this number won't change as opposed to num_io_queues. Fixes: 4d19266022ec ("net: ena: multiple queue creation related cleanups") Signed-off-by: Sameeh Jubran Signed-off-by: Arthur Kiyanovski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -1346,7 +1346,7 @@ static int ena_enable_msix(struct ena_ad } /* Reserved the max msix vectors we might need */ - msix_vecs = ENA_MAX_MSIX_VEC(adapter->num_io_queues); + msix_vecs = ENA_MAX_MSIX_VEC(adapter->max_num_io_queues); netif_dbg(adapter, probe, adapter->netdev, "trying to enable MSI-X, vectors %d\n", msix_vecs);