CVE-2021-47416

phy: mdio: fix memory leak

published May 21, 2024

CVSS
—
EPSS
0%
Percentile
13.4
In the wild
Unconfirmed
What it is

In the Linux kernel, the following vulnerability has been resolved:

phy: mdio: fix memory leak

Syzbot reported memory leak in MDIO bus interface, the problem was in

wrong state logic.

MDIOBUS_ALLOCATED indicates 2 states:

1. Bus is only allocated

2. Bus allocated and __mdiobus_register() fails, but

device_register() was called

In case of device_register() has been called we should call put_device()

to correctly free the memory allocated for this device, but mdiobus_free()

calls just kfree(dev) in case of MDIOBUS_ALLOCATED state

To avoid this behaviour we need to set bus->state to MDIOBUS_UNREGISTERED

_before_ calling device_register(), because put_device() should be

called even in case of device_register() failure.

The record
Technical detail
CVSS
Not scored
CVSS v4.0
Not supplied
EPSS
0.00234 · 13.4th percentile
Published
2024-05-21T15:04Z
EPSS history
Timeline
  • 21 MAY 15:04Z
    phy: mdio: fix memory leak
    cvelistv5