linux-stable/drivers/net/dsa
Greg Ungerer a524eabcd7 net: dsa: mv88e6xxx: fix marvell 6350 probe crash
As of commit b92143d442 ("net: dsa: mv88e6xxx: add infrastructure for
phylink_pcs") probing of a Marvell 88e6350 switch causes a NULL pointer
de-reference like this example:

    ...
    mv88e6085 d0072004.mdio-mii:11: switch 0x3710 detected: Marvell 88E6350, revision 2
    8<--- cut here ---
    Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read
    [00000000] *pgd=00000000
    Internal error: Oops: 5 [#1] ARM
    Modules linked in:
    CPU: 0 PID: 8 Comm: kworker/u2:0 Not tainted 6.7.0-rc2-dirty #26
    Hardware name: Marvell Armada 370/XP (Device Tree)
    Workqueue: events_unbound deferred_probe_work_func
    PC is at mv88e6xxx_port_setup+0x1c/0x44
    LR is at dsa_port_devlink_setup+0x74/0x154
    pc : [<c057ea24>]    lr : [<c0819598>]    psr: a0000013
    sp : c184fce0  ip : c542b8f4  fp : 00000000
    r10: 00000001  r9 : c542a540  r8 : c542bc00
    r7 : c542b838  r6 : c5244580  r5 : 00000005  r4 : c5244580
    r3 : 00000000  r2 : c542b840  r1 : 00000005  r0 : c1a02040
    ...

The Marvell 6350 switch has no SERDES interface and so has no
corresponding pcs_ops defined for it. But during probing a call is made
to mv88e6xxx_port_setup() which unconditionally expects pcs_ops to exist -
though the presence of the pcs_ops->pcs_init function is optional.

Modify code to check for pcs_ops first, before checking for and calling
pcs_ops->pcs_init. Modify checking and use of pcs_ops->pcs_teardown
which may potentially suffer the same problem.

Fixes: b92143d442 ("net: dsa: mv88e6xxx: add infrastructure for phylink_pcs")
Signed-off-by: Greg Ungerer <gerg@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-11-26 11:35:34 +00:00
..
b53 net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
hirschmann net: dsa: hirschmann: Convert to platform remove callback returning void 2023-09-20 10:25:57 +01:00
microchip net: dsa: microchip: ksz9477: Fix spelling mistake "Enery" -> "Energy" 2023-10-27 14:45:50 -07:00
mv88e6xxx net: dsa: mv88e6xxx: fix marvell 6350 probe crash 2023-11-26 11:35:34 +00:00
ocelot net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
qca net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
realtek net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
sja1105 net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
xrs700x net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
Kconfig net: dsa: mt7530: improve and relax PHY driver dependency 2023-08-09 11:22:55 +01:00
Makefile net: dsa: mt7530: introduce driver for MT7988 built-in switch 2023-04-03 10:13:01 +01:00
bcm_sf2.c net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
bcm_sf2.h net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
bcm_sf2_cfp.c net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
bcm_sf2_regs.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
dsa_loop.c net: dsa: dsa_loop: add phylink capabilities 2023-10-11 10:06:05 +01:00
dsa_loop.h
dsa_loop_bdinfo.c
lan9303-core.c net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
lan9303.h
lan9303_i2c.c net: dsa: Switch i2c drivers back to use .probe() 2023-05-31 09:52:55 +01:00
lan9303_mdio.c net: dsa: lan9303: consequently nested-lock physical MDIO 2023-11-02 10:48:09 +01:00
lantiq_gswip.c net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
lantiq_pce.h
mt7530-mdio.c net: dsa: mt7530: fix support for MT7531BE 2023-04-19 17:37:45 -07:00
mt7530-mmio.c net: dsa: mt7530: Convert to platform remove callback returning void 2023-09-20 10:25:57 +01:00
mt7530.c net: dsa: Use conduit and user terms 2023-10-24 13:08:14 -07:00
mt7530.h net: dsa: mt7530: fix handling of 802.1X PAE frames 2023-08-19 12:29:33 +01:00
mv88e6060.c net: dsa: mv88e6060: add phylink_get_caps implementation 2023-08-14 18:57:17 -07:00
mv88e6060.h
rzn1_a5psw.c net: dsa: rzn1_a5psw: Convert to platform remove callback returning void 2023-09-20 10:25:58 +01:00
rzn1_a5psw.h net: dsa: rzn1-a5psw: add vlan support 2023-08-11 11:58:36 +01:00
vitesse-vsc73xx-core.c net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf 2023-10-13 16:28:35 -07:00
vitesse-vsc73xx-platform.c net: dsa: vitesse-vsc73xx: Convert to platform remove callback returning void 2023-09-20 10:25:58 +01:00
vitesse-vsc73xx-spi.c net: dsa: vitesse-vsc73xx: remove unnecessary set_drvdata() 2022-09-22 19:30:39 -07:00
vitesse-vsc73xx.h net: dsa: vsc73xxx: Make vsc73xx_remove() return void 2021-11-15 13:15:07 +00:00