From nobody Wed Oct 30 01:03:42 2024 X-Original-To: dev-commits-src-all@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 4XdTQk5zDnz5bHHh; Wed, 30 Oct 2024 01:03:42 +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 4XdTQk5DJHz4LZr; Wed, 30 Oct 2024 01:03:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730250222; 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=32PXllp2KO8kAZozepnpcc1Gb8aWRCYhT1IIlOxdoNY=; b=muNhk5CSvMVXM20qZRFtIlCl8LLwiYr/Ni2MJg64ZCFRaRIxF510SAPb25DBBqJqj3W/5A eJpJSmUXLoDAdJK5uuf8Fgr5tYT9uOG8lkWRCMoJ9Reb8lqUVFLWpBkD1dEbEeux2HIgQ1 AwgfKsxfma8RfHYdgOp1fNXLNBeDZwMzTR9Ad5RX8GWAFjNMcMSckIKrCLP50TTmgpaU9+ JAU5Lahb53wHbtH99jFPc+2PFqEa3EaGtlDd4fDPLBrNbLrhYHl4g62aOiF6dCEv5itOUv 75NY3YckamARk9bdCTh6ZX42IGlN+kSbWHPtpxbkK4MXqsT0gxio+CUIY+PRgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730250222; 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=32PXllp2KO8kAZozepnpcc1Gb8aWRCYhT1IIlOxdoNY=; b=Jmd6LV4ZV65zjEh7T+NzYSrm4pCWcg/vgTlgLOSmTT0AZIiirV54dRzevVDbZD9FmDRE1S IhZmuJsjpQYsSCZ4cEhl1nEmBN2UV9zgo7T8KBjzpeenS9aObrkvvZGDgx+Xj5LeCOgGzp bsFVn0Hz9wBIKNty0IXtQasLqFUvg+Y8eBLwA28iUh8+YP727bDgoQq8H8o2fkBYvZc5mk w+Ch10YsX3n+AI2YuH/h0mqzf3f0wfPy/YFvEBxqDoENhwojdxAOTp+35AuWmYVB4Pfpf4 SrNcT2JvzqJCGYbLN7JmIej6BDp3AHvxuFJrnylMdTPI60n+dOnfoEcRzkPJbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730250222; a=rsa-sha256; cv=none; b=eYgOoqhgU88QfmBdsk7e42IM/fft+2DQDz36O3OoMA+nt1eNcNxGM0uJeitNBdpEpKPKHB lm+2Xl0PbClFIEM3EWgb9iQ/YLD3T3+GlbSEj7ztpgt50GZx/hRcmQ15uz0woA1W6tNkzO JXqoybjiSEci9IbKQisuY3XLKdOid019sumHOCGhJ99jbC6/ncLIYQQQCUHmSNlGDAw0BQ UpjlHbEJZz6YBEmEaxdK7MZWwg38849FK/Ck9DZFQy4xX/7O/V7SehxNFuriw3m+gyitWr if1PJB8QGWhfOYLuMncNftjtgzteGSrCqsf7MfJvIfSw38bLDSs+Fl9o8ZMjig== 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 4XdTQk4qWFzmpx; Wed, 30 Oct 2024 01:03:42 +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 49U13gxp023830; Wed, 30 Oct 2024 01:03:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49U13gWM023827; Wed, 30 Oct 2024 01:03:42 GMT (envelope-from git) Date: Wed, 30 Oct 2024 01:03:42 GMT Message-Id: <202410300103.49U13gWM023827@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 453f85caa93a - stable/13 - ixv: Check cap return before MSI-X enable write List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 453f85caa93a431911b66b2cd781595e4ebd59ec Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=453f85caa93a431911b66b2cd781595e4ebd59ec commit 453f85caa93a431911b66b2cd781595e4ebd59ec Author: Jeremiah Lott AuthorDate: 2024-10-27 07:18:54 +0000 Commit: Kevin Bowling CommitDate: 2024-10-30 01:02:46 +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 Sponsored by: BBOX.io (cherry picked from commit b87b3696c973ef0a9df70143cd89f6b488531e93) --- 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 91ed47df429d..1a9514dc5b07 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);