Skip to content

Commit 68a007a

Browse files
Jiawen Wugregkh
authored andcommitted
net: libwx: fix VF illegal register access
commit 694de31 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: a04ea57 ("net: libwx: fix device bus LAN ID") Cc: stable@vger.kernel.org Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Link: https://patch.msgid.link/4D1F4452D21DE107+20260429083743.88961-1-jiawenwu@trustnetic.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6f6a50a commit 68a007a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • drivers/net/ethernet/wangxun/libwx

drivers/net/ethernet/wangxun/libwx/wx_hw.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,8 +2480,11 @@ int wx_sw_init(struct wx *wx)
24802480
wx->oem_svid = pdev->subsystem_vendor;
24812481
wx->oem_ssid = pdev->subsystem_device;
24822482
wx->bus.device = PCI_SLOT(pdev->devfn);
2483-
wx->bus.func = FIELD_GET(WX_CFG_PORT_ST_LANID,
2484-
rd32(wx, WX_CFG_PORT_ST));
2483+
if (pdev->is_virtfn)
2484+
wx->bus.func = PCI_FUNC(pdev->devfn);
2485+
else
2486+
wx->bus.func = FIELD_GET(WX_CFG_PORT_ST_LANID,
2487+
rd32(wx, WX_CFG_PORT_ST));
24852488

24862489
if (wx->oem_svid == PCI_VENDOR_ID_WANGXUN ||
24872490
pdev->is_virtfn) {

0 commit comments

Comments
 (0)