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 D03931A618F; Tue, 30 Jul 2024 16:45:37 +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=1722357937; cv=none; b=Zg/4YuJMqTWK7gh2eHbFcXreoAyxJ+LZeLU24gboLkz3Y7R93l4i3X2+5TT1FWVnEQ4qgqPoZR71+xhqxHfdYzF4CtGXdfcU6pSyYVLPGT0em9Xs7DHs0Ez6FOmU8z2+lrSpxMJ88tqWbYRwvqQDmPhQLr48QCPhjDLYgY3lqII= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722357937; c=relaxed/simple; bh=SCdon+1jEO4K4k++SvFKhwBLhdqpKPhojeGA1qLafY8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OWjOG1PGCH/3NMqlH/9UoyXZvd6E5zadaZwOy33k3q/c2E3bp2JuvC9ftat6XUlZpobCFm2MzF5IUpDIIQl6G63Zn4SjvK2uUIp4uKA3guJqP6DeCHrVvGY5yPCiqlUSmuVRiPTVok3CQ1HnI4Jl6gjhmR3ee4yjE227X15ZQRE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0aMsx/T9; 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="0aMsx/T9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C3CDC32782; Tue, 30 Jul 2024 16:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722357937; bh=SCdon+1jEO4K4k++SvFKhwBLhdqpKPhojeGA1qLafY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0aMsx/T9mAMLs+JoT6Z3xZ7CUR1Xfaa/r5YlavQFroVJlWlVgHlCqocqZ4lW5fRy1 rwtHS0DjccnasfQ1udHfxZvHFIygiINdZlmJt0a15X00MZwTebY1+kETT9i/RAX/6m 7pTpJ5jxTD3S3ehZz5q7tDWux5tTlxCw9ORaCNAk= 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 6.1 322/440] PCI: hv: Return zero, not garbage, when reading PCI_INTERRUPT_PIN Date: Tue, 30 Jul 2024 17:49:15 +0200 Message-ID: <20240730151628.395680815@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730151615.753688326@linuxfoundation.org> References: <20240730151615.753688326@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 6.1-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 @@ -1092,8 +1092,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