В ядре Linux устранена следующая уязвимость:
net: phy: sfp: бесплатно mii_bus в sfp_i2c_mdiobus_destroy
sfp_i2c_mdiobus_create() выделяет шину I2C MDIO с помощью mdio_i2c_alloc(),
простое (не devm) распределение и регистрирует его. sfp_i2c_mdiobus_destroy()
только отменяет регистрацию шины и очищает sfp->i2c_mii без вызова
mdiobus_free(). Поскольку при этом удаляется единственная ссылка на шину,
Утечка структуры mii_bus. Это происходит всякий раз, когда модуль SFP Copper/RollBall, создавший экземпляр MDIO,
шина удалена: sfp_sm_main() берет глобальный путь удаления и вызывает
sfp_i2c_mdiobus_destroy(). sfp_cleanup(), при отмене привязки драйвера, освобождает
sfp->i2c_mii напрямую, поэтому утечка произошла только в модуле
горячее удаление, а не отвязывание.
Освободите шину в sfp_i2c_mdiobus_destroy(), чтобы она соответствовала распределению, сделанному в
sfp_i2c_mdiobus_create().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net: phy: sfp: free mii_bus in sfp_i2c_mdiobus_destroy sfp_i2c_mdiobus_create() allocates the I2C MDIO bus with mdio_i2c_alloc(), a plain (non-devm) allocation, and registers it. sfp_i2c_mdiobus_destroy() only unregisters the bus and clears sfp->i2c_mii without calling mdiobus_free(). As the only reference to the bus is then cleared, the struct mii_bus is leaked. This is hit whenever a copper/RollBall SFP module that instantiated an MDIO bus is removed: sfp_sm_main() takes the global teardown path and calls sfp_i2c_mdiobus_destroy(). sfp_cleanup(), on driver unbind, frees sfp->i2c_mii directly, which is why the leak only triggered on module hot-removal and not on unbind. Free the bus in sfp_i2c_mdiobus_destroy() to match the allocation done in sfp_i2c_mdiobus_create().