Back

MEDIUM

net: dsa: bcm_sf2: Fix a possible memory leak in bcm_sf2_mdio_register()

Published Sep 4, 2024

Description

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.

Affected products

Remediation

No remediation recorded yet.

Weaknesses (1)

References (14)

Change history (0)

No recorded changes yet.

Sources
CVE.org / MITRE
Status PUBLISHED
Assigner Linux
Published Sep 4, 2024
Updated May 11, 2026
Reserved Aug 21, 2024
CISA Vulnrichment
Updated Sep 10, 2024
NVD
Status Modified
Modified Jun 17, 2026
Red Hat
Severity Moderate
Public date Sep 4, 2024
ENISA EUVD
Assigner Linux
Published Sep 4, 2024
Updated May 11, 2026
Exploited since n/a
EUVD-2024-41173