Skip to content
Commit bc0e610a authored by Jianglei Nie's avatar Jianglei Nie Committed by Jakub Kicinski
Browse files

net: arc_emac: Fix use after free in arc_mdio_probe()

If bus->state is equal to MDIOBUS_ALLOCATED, mdiobus_free(bus) will free
the "bus". But bus->name is still used in the next line, which will lead
to a use after free.

We can fix it by putting the name in a local variable and make the
bus->name point to the rodata section "name",then use the name in the
error message without referring to bus to avoid the uaf.

Fixes: 95b5fc03

 ("net: arc_emac: Make use of the helper function dev_err_probe()")
Signed-off-by: default avatarJianglei Nie <niejianglei2021@163.com>
Link: https://lore.kernel.org/r/20220309121824.36529-1-niejianglei2021@163.com
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 633593a8
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment