]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: eth: fbnic: Fix addr validation in pcs write
authorMike Marciniszyn (Meta) <mike.marciniszyn@gmail.com>
Thu, 7 May 2026 15:42:03 +0000 (11:42 -0400)
committerJakub Kicinski <kuba@kernel.org>
Sun, 10 May 2026 17:09:13 +0000 (10:09 -0700)
The DW IP has two distinct PCS address ranges cooresponding
to the C45 PCS registers.

The shim translates the PCS addr/regno into specific CSR writes
into one of those two zero-relative ranges.

This patch fixes a one off in the test that could allow an invalid
CSR write if an addr == 2 was called.

There are is of yet, no real impact for the bug as no PCS writes are
present.

Signed-off-by: Mike Marciniszyn (Meta) <mike.marciniszyn@gmail.com>
Link: https://patch.msgid.link/20260507154203.3667-1-mike.marciniszyn@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/meta/fbnic/fbnic_mdio.c

index 7a8727e8f6f2524def12d4d3670aa184fd394b76..fe3a4ce88413c6a9ebb60eed0a8336997aaf0b60 100644 (file)
@@ -189,7 +189,7 @@ fbnic_mdio_write_pcs(struct fbnic_dev *fbd, int addr, int regnum, u16 val)
                addr, regnum, val);
 
        /* Allow access to both halves of PCS for 50R2 config */
-       if (addr > 2)
+       if (addr >= 2)
                return;
 
        /* Skip write for reserved registers */