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 3C9543C8C7D; Tue, 12 May 2026 17:45:03 +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=1778607903; cv=none; b=a1WqR7+fHDaw1sFTl2FOKoxDqCuXmyO/szeva3KV1CfbWlD5JdguOB6MmH7sKk09yACDl89pdC6+FtP2jagJlHDdN8lxdS5Z1hj546uXdWxwDRY16hNj6oBWoh3wDPp8IRy4Ij8vuMNGZTkrGpNVGr6UUI2LSxyOsJXkrUxrP5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778607903; c=relaxed/simple; bh=orfxdR1X8iC+yrgTxa5yyqqe0hOLe7CgbvVW2dil9ys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XH25oL9GpdMQ9ypkcQ2NfIktJ4I/TyWi8NqC+GB/wA359L76GhgS26QtmDh1uf7hku2tyu2se7ALYkCzwiIOVoSvd7MmneL/MjeV9EY0hW8qE6kexgd0NnDkM/eCmncSl/FSPAwCV1AyxIzj/NdnV0doIncIWBV3uUQwwR1LSog= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R5H0Mfxr; 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="R5H0Mfxr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8EA2C2BCB0; Tue, 12 May 2026 17:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778607903; bh=orfxdR1X8iC+yrgTxa5yyqqe0hOLe7CgbvVW2dil9ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R5H0MfxrjZzYUMCXOUecDSqxg7Kpzgi9Hb7I4Mqws9PjtG0sIOMY7d0n/8Q6CkLoE zzReA8976RRLjW2jbV0t/3WVxDi60U2GK29+aGVhSRuwY4c5ewMPQIz5Qiw2NpnEKB L8kSh26RcO8TlfuaZRbgQg/lZq2oQOtAK3tKMf54= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiawen Wu , Jakub Kicinski Subject: [PATCH 6.12 080/206] net: libwx: fix VF illegal register access Date: Tue, 12 May 2026 19:38:52 +0200 Message-ID: <20260512173934.545830093@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260512173932.810559588@linuxfoundation.org> References: <20260512173932.810559588@linuxfoundation.org> User-Agent: quilt/0.69 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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiawen Wu commit 694de316f607fe2473d52ca0707e3918e72c1562 upstream. Register WX_CFG_PORT_ST is a PF restricted register. When a VF is initialized, attempting to read this register triggers an illegal register access, which lead to a system hang. When the device is VF, the bus function ID can be obtained directly from the PCI_FUNC(pdev->devfn). Fixes: a04ea57aae37 ("net: libwx: fix device bus LAN ID") Cc: stable@vger.kernel.org Signed-off-by: Jiawen Wu Link: https://patch.msgid.link/4D1F4452D21DE107+20260429083743.88961-1-jiawenwu@trustnetic.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/wangxun/libwx/wx_hw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/wangxun/libwx/wx_hw.c +++ b/drivers/net/ethernet/wangxun/libwx/wx_hw.c @@ -1943,8 +1943,11 @@ int wx_sw_init(struct wx *wx) wx->oem_svid = pdev->subsystem_vendor; wx->oem_ssid = pdev->subsystem_device; wx->bus.device = PCI_SLOT(pdev->devfn); - wx->bus.func = FIELD_GET(WX_CFG_PORT_ST_LANID, - rd32(wx, WX_CFG_PORT_ST)); + if (pdev->is_virtfn) + wx->bus.func = PCI_FUNC(pdev->devfn); + else + wx->bus.func = FIELD_GET(WX_CFG_PORT_ST_LANID, + rd32(wx, WX_CFG_PORT_ST)); if (wx->oem_svid == PCI_VENDOR_ID_WANGXUN) { wx->subsystem_vendor_id = pdev->subsystem_vendor;