Skip to content

Commit d3bd804

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 6162e82 commit d3bd804

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
@@ -1667,8 +1667,11 @@ int wx_sw_init(struct wx *wx)
16671667
wx->oem_svid = pdev->subsystem_vendor;
16681668
wx->oem_ssid = pdev->subsystem_device;
16691669
wx->bus.device = PCI_SLOT(pdev->devfn);
1670-
wx->bus.func = FIELD_GET(WX_CFG_PORT_ST_LANID,
1671-
rd32(wx, WX_CFG_PORT_ST));
1670+
if (pdev->is_virtfn)
1671+
wx->bus.func = PCI_FUNC(pdev->devfn);
1672+
else
1673+
wx->bus.func = FIELD_GET(WX_CFG_PORT_ST_LANID,
1674+
rd32(wx, WX_CFG_PORT_ST));
16721675

16731676
if (wx->oem_svid == PCI_VENDOR_ID_WANGXUN) {
16741677
wx->subsystem_vendor_id = pdev->subsystem_vendor;

0 commit comments

Comments
 (0)