From nobody Sun Oct 27 07:22:39 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XbnzM1rX2z5bhpT; Sun, 27 Oct 2024 07:22:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XbnzM1NF3z4SDF; Sun, 27 Oct 2024 07:22:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730013759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dNf8J/KWQc4xbMNneoS/wQsxtQGYQzx+XlwsPFTC1wc=; b=oowAPEBfGo1KbioMCmmEZ7cLmRGSxN1nC2fTzKwmOERNPbBEaFoICCXWDG7xQ57Y3W82aB 4P+SY3+gukvmhw+Gl7yPm/rEcM9yGDWfZXJgLRyftiTvoLVySlHss8xBmrl/zWAko3g2v/ QRPsXtWHkiFoSohadfZhtIMrq0GL96WjQegW6vnMJgNwwy4KxMqp9Pg/HK/F7CxMISneBN t82O7ARSn5KRBLRXzFi+dEdBBKusSwICd6ThVmEq4NzocH5MfXArKj+9/AozWnpLfkcSoI Hz2FBPNh3fClN6QKFHJAWrRXM3+RRolFN0WA3nMOf8wPT9fd+xspdqjT6QSRfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730013759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dNf8J/KWQc4xbMNneoS/wQsxtQGYQzx+XlwsPFTC1wc=; b=A3k7aVol5E+E8GvBIvZ50afsmFY+pYvl0qbVm0w/D8WZA+7rx2y+M/5A729mkjYE6iFGZ/ ZYA8800yqmpbOwW0UOasFJxMpUsreoTDdB00Gnl/xW9Ms6nqIb2b73MJbI+chgsut2UE6k 8yhDVPXY5RuZgJ0Z/NG8vEx1/27SMED8HrX8MSJNdFE6STvTuyf4i9bEd4+8Xbn0yMvoO0 mZDnRlJD41ppKRPGNrUHeTNWKgPApu1MLWJ65l0OcRak3CUmiU3Ux+UonzRPp9dIaMeMQH DQosUyCe3RAkbiLIT4NhSNJ2Y57NuQrnpgOwbHnvI+vp1NmfcjC3iaM+yf3lnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730013759; a=rsa-sha256; cv=none; b=OolOsmAb8pmgN8su/0adUYc+MuOEXbDlVKzrZc4flzqqCwJ91evDloUZzM31Qb5v3SoeR5 joRdz3BIT2neblai2d/5yYsd0hzGSA8dypRK54a5aLTllCHb/sQwlmHv+dLto/PQ2Ylgs9 VJa8rW07wQ7JriUOyd03bP+RZdUTD6Zkx3divaCF8ZgXuK8TaJb0WASqkzNJ7OTqtd4fen yI9xZHI4rm2K12+jiA8WEtQ162VjlAxIa9+Y0G4hpetHKxjXdvJNLIwmg/CK+SOQSVRxAA sYyQEd9Gvk3TSwIACBMDeMtli9jDIy32we0BduZFM+PWH9EZPsWIDYIEH7HvAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XbnzM0tnMzl5j; Sun, 27 Oct 2024 07:22:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49R7MdqK018796; Sun, 27 Oct 2024 07:22:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49R7Mdup018793; Sun, 27 Oct 2024 07:22:39 GMT (envelope-from git) Date: Sun, 27 Oct 2024 07:22:39 GMT Message-Id: <202410270722.49R7Mdup018793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: b87b3696c973 - main - ixv: Check cap return before MSI-X enable write List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b87b3696c973ef0a9df70143cd89f6b488531e93 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=b87b3696c973ef0a9df70143cd89f6b488531e93 commit b87b3696c973ef0a9df70143cd89f6b488531e93 Author: Jeremiah Lott AuthorDate: 2024-10-27 07:18:54 +0000 Commit: Kevin Bowling CommitDate: 2024-10-27 07:18:54 +0000 ixv: Check cap return before MSI-X enable write In the QEMU workaround code in if_ixv.c, the ixv driver calls pci_find_cap(dev, PCIY_MSIX, &rid). It is not checking the return code from that function and the function appears to always be failing. This then causes the driver to use the rid variable uninitialized, which will mean setting a bit at an arbitrary offset in pci config space. For now, this seems to have no adverse impact, but it could easily cause very subtle problems. PR: 207037 MFC after: 3 days Sponsored by: BBOX.io --- sys/dev/ixgbe/if_ixv.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 467a56e7269f..58384af5eea7 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -1073,11 +1073,14 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix) */ if (sc->hw.mac.type == ixgbe_mac_82599_vf) { int msix_ctrl; - pci_find_cap(dev, PCIY_MSIX, &rid); - rid += PCIR_MSIX_CTRL; - msix_ctrl = pci_read_config(dev, rid, 2); - msix_ctrl |= PCIM_MSIXCTRL_MSIX_ENABLE; - pci_write_config(dev, rid, msix_ctrl, 2); + if (pci_find_cap(dev, PCIY_MSIX, &rid)) { + device_printf(dev, "Finding MSIX capability failed\n"); + } else { + rid += PCIR_MSIX_CTRL; + msix_ctrl = pci_read_config(dev, rid, 2); + msix_ctrl |= PCIM_MSIXCTRL_MSIX_ENABLE; + pci_write_config(dev, rid, msix_ctrl, 2); + } } return (0);