Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3695230ybv; Mon, 10 Feb 2020 04:52:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyd7mp38HUaeB9U6guaO9Sh+UT4sB4Y9xhngEmuuIt7FL52Nu2a6Hz+lARefEILg0DYvl8A X-Received: by 2002:a05:6808:244:: with SMTP id m4mr712867oie.125.1581339148096; Mon, 10 Feb 2020 04:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339148; cv=none; d=google.com; s=arc-20160816; b=gVBRr35fF6/+eTymJaUDmbYnwuiFxhGNPMirrKjGh9EdAWPLaUYXWvBpC8qK+NlkQP agx0hJbgXzaT0ZLNH+FAEMzHebofkicgnTbeFr9FQs4pVredzwrdgrhMdCPqGylFlPCo kE5XDKwVxgmLfZLleIrF0VP05seilUr+qt0XPc1UHC2ge0E3yN7N3PnldRHaTg96zFMU rmMrgXyyQosMrIcTbQrieoDu/5sin9CQrsfaLNGcbH5VEP40PabHjO0lo/88EvuFigcK niTFB1c23m3kChXOx/3kVjpoJWaEygQCZb4FQNtlWrBe0vlN0BCnHfyXiED7nYQR5ubt WpOw== 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=sP8RZEHICP/AqVukWQCQaJfPDon/g8lrLpwcD7NDi7s=; b=XDjIFFPBKXPbrAY0R7SBhCoAiVDtnlOTzqqr39W4Xzm1F3IX5KzKLHfNb0qohmJOR4 J9b7Z+38OfTyNTWVQvya4ScKvyzzkuYW8x5/iErG7etihooAuRuoOSQB9i3jsyg/1CXg T1OHqOzrVGs07FD0WKJGN3y+xF3it3TAvCV36rPlIhRbbZopBeCR5iQ3R9sz889oZ7/6 rY+Au5N1n3aHkEL/k8LOZFoCBYbla2Kgv/70LMAWQK6WbEXLO4Evg2YDtqtxHiMhJUQ7 T5uLZN9EFZSt4lXjfXaWwygYpo9bp6vZXSiMRw8FPvry0mcua1IaodbBRKZe+fiaFJmv EwWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GGeMSIs1; 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 k10si144975otn.323.2020.02.10.04.52.16; Mon, 10 Feb 2020 04:52:28 -0800 (PST) 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=GGeMSIs1; 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 S1728651AbgBJMu4 (ORCPT + 99 others); Mon, 10 Feb 2020 07:50:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:47972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730137AbgBJMoE (ORCPT ); Mon, 10 Feb 2020 07:44:04 -0500 Received: from localhost (unknown [209.37.97.194]) (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 77E202080C; Mon, 10 Feb 2020 12:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338644; bh=PuO13LKVTYDSxri5SOudHC2t0XeLAaovGg0Nb14h168=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGeMSIs1F8jF9VYoxo/WvVBh17QJyM5CoKJJkQjyqC5n+MsfdelcLBp/Q96hX2nyx T5OG741rfow1WrkrQ89G1mrE8ZksYsAKnTq0wPdyrGhXiTyeq24bNo08kDHjyXSEMb hevvPcD711pemuhYU2IP25wA8s6C6pG0MpnKWdZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cornelia Huck , Daniel Verkamp , "Michael S. Tsirkin" , "Wang, Wei W" Subject: [PATCH 5.5 275/367] virtio-pci: check name when counting MSI-X vectors Date: Mon, 10 Feb 2020 04:33:08 -0800 Message-Id: <20200210122449.575683757@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@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: Daniel Verkamp commit 303090b513fd1ee45aa1536b71a3838dc054bc05 upstream. VQs without a name specified are not valid; they are skipped in the later loop that assigns MSI-X vectors to queues, but the per_vq_vectors loop above that counts the required number of vectors previously still counted any queue with a non-NULL callback as needing a vector. Add a check to the per_vq_vectors loop so that vectors with no name are not counted to make the two loops consistent. This prevents over-counting unnecessary vectors (e.g. for features which were not negotiated with the device). Cc: stable@vger.kernel.org Fixes: 86a559787e6f ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Reviewed-by: Cornelia Huck Signed-off-by: Daniel Verkamp Signed-off-by: Michael S. Tsirkin Reviewed-by: Wang, Wei W Signed-off-by: Greg Kroah-Hartman --- drivers/virtio/virtio_pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -294,7 +294,7 @@ static int vp_find_vqs_msix(struct virti /* Best option: one for change interrupt, one per vq. */ nvectors = 1; for (i = 0; i < nvqs; ++i) - if (callbacks[i]) + if (names[i] && callbacks[i]) ++nvectors; } else { /* Second best: one for change, shared for all vqs. */