From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDCAE1DFFB; Thu, 15 Aug 2024 14:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723732448; cv=none; b=garOll2y/yDA1CkGfRHK02L8M/6G3R5uM5/GSTVU0V0MVSrFNMgSWVr3H6opxJoZY66ZLSegm0MyI/X9apH/0PF9iQ5TZY5+/ip/zC8RkzQxIvZF9ZYKEFGm2zxaLkUlm48lzdSJ2hISY6GtdXIIpri1jysSd+CKrLLlZAUzEoc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723732448; c=relaxed/simple; bh=2by8ZFF3jkERSMvPFBRk6JwqLNongUISXAQo8xWQIvk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sadIYB8jznKn9zVZFrOREuzx9i+ZErnuxYxO/t7lEEqcYjQXpFfslUCFBDDB6VOo2WBun7+7O+8nFo1WSuCjv31veZI39nBrQarMUHjla1hmXoh4mpdJ/ky8GtWv8rH2NevJ19d53RX04FGSZF0i49YkcXjPDcutlBdbIA9IZvk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hBDpK0AM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hBDpK0AM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C373C4AF0C; Thu, 15 Aug 2024 14:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723732448; bh=2by8ZFF3jkERSMvPFBRk6JwqLNongUISXAQo8xWQIvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hBDpK0AMiv5IEzHWj8RAO3NTmmQYHAUzEB3Tnk1308oCJfXnoNtdJ3LDQ8d/n0lD0 5JY3EI0nhxoE62T1qJg8huaVe8FyuklqD/gQriXgyaiB1rvx/88AKiCdYqWwd/l6B+ rqMupHTNwHA82LNMiwRMytHQsh+tPI0SPz4jbA44= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wei Liu , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Michael Kelley , stable@kernel.org Subject: [PATCH 5.10 152/352] PCI: hv: Return zero, not garbage, when reading PCI_INTERRUPT_PIN Date: Thu, 15 Aug 2024 15:23:38 +0200 Message-ID: <20240815131925.140428804@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240815131919.196120297@linuxfoundation.org> References: <20240815131919.196120297@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wei Liu commit fea93a3e5d5e6a09eb153866d2ce60ea3287a70d upstream. The intent of the code snippet is to always return 0 for both PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN. The check misses PCI_INTERRUPT_PIN. This patch fixes that. This is discovered by this call in VFIO: pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin); The old code does not set *val to 0 because it misses the check for PCI_INTERRUPT_PIN. Garbage is returned in that case. Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs") Link: https://lore.kernel.org/linux-pci/20240701202606.129606-1-wei.liu@kernel.org Signed-off-by: Wei Liu Signed-off-by: Krzysztof WilczyƄski Reviewed-by: Michael Kelley Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/pci-hyperv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -680,8 +680,8 @@ static void _hv_pcifront_read_config(str PCI_CAPABILITY_LIST) { /* ROM BARs are unimplemented */ *val = 0; - } else if (where >= PCI_INTERRUPT_LINE && where + size <= - PCI_INTERRUPT_PIN) { + } else if ((where >= PCI_INTERRUPT_LINE && where + size <= PCI_INTERRUPT_PIN) || + (where >= PCI_INTERRUPT_PIN && where + size <= PCI_MIN_GNT)) { /* * Interrupt Line and Interrupt PIN are hard-wired to zero * because this front-end only supports message-signaled