mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
net: libwx: fix VF illegal register access
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: a04ea57aae ("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>
This commit is contained in:
parent
26ebd12e67
commit
694de316f6
|
|
@ -2480,8 +2480,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 ||
|
||||
pdev->is_virtfn) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user