kernel_samsung_a53x/drivers/net/dsa
Joe Hattori be9d7e8db2 net: dsa: bcm_sf2: Fix a possible memory leak in bcm_sf2_mdio_register()
[ Upstream commit e3862093ee93fcfbdadcb7957f5f8974fffa806a ]

bcm_sf2_mdio_register() calls of_phy_find_device() and then
phy_device_remove() in a loop to remove existing PHY devices.
of_phy_find_device() eventually calls bus_find_device(), which calls
get_device() on the returned struct device * to increment the refcount.
The current implementation does not decrement the refcount, which causes
memory leak.

This commit adds the missing phy_device_free() call to decrement the
refcount via put_device() to balance the refcount.

Fixes: 771089c2a485 ("net: dsa: bcm_sf2: Ensure that MDIO diversion is used")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20240806011327.3817861-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:20:22 +01:00
..
b53 net: dsa: b53: Limit chip-wide jumbo frame config to CPU ports 2024-11-23 23:20:11 +01:00
microchip net: dsa: microchip: fix initial port flush problem 2024-11-19 14:19:31 +01:00
mv88e6xxx net: dsa: mv88e6xxx: Limit chip-wide frame size config to CPU ports 2024-11-23 23:20:11 +01:00
ocelot Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qca Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sja1105 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm_sf2.c net: dsa: bcm_sf2: Fix a possible memory leak in bcm_sf2_mdio_register() 2024-11-23 23:20:22 +01:00
bcm_sf2.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm_sf2_cfp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm_sf2_regs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dsa_loop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dsa_loop.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dsa_loop_bdinfo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lan9303-core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lan9303.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lan9303_i2c.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lan9303_mdio.c net: dsa: lan9303: consequently nested-lock physical MDIO 2024-11-18 11:43:30 +01:00
lantiq_gswip.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lantiq_pce.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mt7530.c net: dsa: mt7530: prevent possible incorrect XTAL frequency selection 2024-11-19 08:44:59 +01:00
mt7530.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mv88e6060.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mv88e6060.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qca8k.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qca8k.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
realtek-smi-core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
realtek-smi-core.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtl8366.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtl8366rb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vitesse-vsc73xx-core.c net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe 2024-11-18 12:12:51 +01:00
vitesse-vsc73xx-platform.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vitesse-vsc73xx-spi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vitesse-vsc73xx.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00