linux-stable/drivers/net/dsa
Ahmad Fatoum b93eb56486 net: dsa: realtek: fix out-of-bounds access
The probe function sets priv->chip_data to (void *)priv + sizeof(*priv)
with the expectation that priv has enough trailing space.

However, only realtek-smi actually allocated this chip_data space.
Do likewise in realtek-mdio to fix out-of-bounds accesses.

These accesses likely went unnoticed so far, because of an (unused)
buf[4096] member in struct realtek_priv, which caused kmalloc to
round up the allocated buffer to a big enough size, so nothing of
value was overwritten. With a different allocator (like in the barebox
bootloader port of the driver) or with KASAN, the memory corruption
becomes quickly apparent.

Fixes: aac9400106 ("net: dsa: realtek: add new mdio interface for drivers")
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.kernel.org/r/20230323103735.2331786-1-a.fatoum@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-03-24 19:04:43 -07:00
..
b53 net: dsa: b53: mmap: fix device tree support 2023-03-17 21:56:31 -07:00
hirschmann net: devlink: let the core report the driver name instead of the drivers 2022-11-30 21:49:38 -08:00
microchip net: dsa: microchip: fix RGMII delay configuration on KSZ8765/KSZ8794/KSZ8795 2023-03-16 21:23:07 -07:00
mv88e6xxx net: dsa: mv88e6xxx: fix max_mtu of 1492 on 6165, 6191, 6220, 6250, 6290 2023-03-16 17:39:42 +00:00
ocelot net: dsa: ocelot_ext: remove unnecessary phylink.h include 2023-02-26 18:41:33 +00:00
qca net: dsa: qca8k: convert to regmap read/write API 2023-01-27 12:06:45 +00:00
realtek net: dsa: realtek: fix out-of-bounds access 2023-03-24 19:04:43 -07:00
sja1105 net: Remove C45 check in C22 only MDIO bus drivers 2023-01-20 18:12:45 -08:00
xrs700x net: dsa: xrs700x: Convert to i2c's .probe_new() 2022-11-23 12:50:06 -08:00
bcm_sf2.c net: dsa: bcm_sf2: remove unnecessary platform_set_drvdata() 2022-09-22 19:30:35 -07:00
bcm_sf2.h net: dsa: bcm_sf2: refactor LED regs access 2021-12-30 17:28:32 -08:00
bcm_sf2_cfp.c net: dsa: introduce dsa_port_get_master() 2022-09-20 10:32:35 +02: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: Fix possible memory leaks in dsa_loop_init() 2022-10-28 10:32:59 +01:00
dsa_loop.h
dsa_loop_bdinfo.c
Kconfig net: dsa: mt7530: fix tristate and help description 2023-01-27 22:33:49 -08:00
lan9303-core.c dsa: lan9303: Add flow ctrl in link_up 2023-01-20 08:53:13 +00:00
lan9303.h
lan9303_i2c.c net: dsa: lan9303: Convert to i2c's .probe_new() 2022-11-23 12:50:05 -08:00
lan9303_mdio.c net: dsa: lan9303: remove unnecessary dev_set_drvdata() 2022-09-22 19:30:36 -07:00
lantiq_gswip.c net: dsa: lantiq_gswip: remove unnecessary platform_set_drvdata() 2022-09-22 19:30:36 -07:00
lantiq_pce.h
Makefile net: dsa: qca8k: move driver to qca dir 2022-07-15 11:57:13 +01:00
mt7530.c net: dsa: mt7530: move setting ssc_delta to PHY_INTERFACE_MODE_TRGMII case 2023-03-22 22:14:45 -07:00
mt7530.h net: dsa: mt7530: Separate C22 and C45 MDIO bus transactions 2023-01-17 19:34:07 -08:00
mv88e6060.c net: dsa: mv88e6060: remove unnecessary dev_set_drvdata() 2022-09-22 19:30:37 -07:00
mv88e6060.h
rzn1_a5psw.c net: Remove C45 check in C22 only MDIO bus drivers 2023-01-20 18:12:45 -08:00
rzn1_a5psw.h net: dsa: rzn1-a5psw: add FDB support 2022-06-27 11:37:55 +01:00
vitesse-vsc73xx-core.c net: dsa: vsc73xxx: Get rid of duplicate of_node assignment 2021-12-03 14:13:02 +00:00
vitesse-vsc73xx-platform.c net: dsa: vitesse-vsc73xx: remove unnecessary set_drvdata() 2022-09-22 19:30:39 -07: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