summary refs log tree commit diff
path: root/tools/testing
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2022-02-10 19:40:17 +0200
committerJakub Kicinski <kuba@kernel.org>2022-02-10 11:46:03 -0800
commit51a04ebf21122d5c76a716ecd9bfc33ea44b2b39 (patch)
tree626e5116331ffee051251a8517610df7214568f7 /tools/testing
parenta19f7d7da9b3ffe8fcc43203a2d49c096d0754f6 (diff)
downloadlinux-51a04ebf21122d5c76a716ecd9bfc33ea44b2b39.tar.gz
net: dsa: mv88e6xxx: fix use-after-free in mv88e6xxx_mdios_unregister
Since struct mv88e6xxx_mdio_bus *mdio_bus is the bus->priv of something
allocated with mdiobus_alloc_size(), this means that mdiobus_free(bus)
will free the memory backing the mdio_bus as well. Therefore, the
mdio_bus->list element is freed memory, but we continue to iterate
through the list of MDIO buses using that list element.

To fix this, use the proper list iterator that handles element deletion
by keeping a copy of the list element next pointer.

Fixes: f53a2ce893b2 ("net: dsa: mv88e6xxx: don't use devres for mdiobus")
Reported-by: Rafael Richter <rafael.richter@gin.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20220210174017.3271099-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing')
0 files changed, 0 insertions, 0 deletions