Pavel Skripkin 10eff1f578 Revert "net: mdiobus: Fix memory leak in __mdiobus_register"
This reverts commit ab609f25d19858513919369ff3d9a63c02cd9e2e.

This patch is correct in the sense that we _should_ call device_put() in
case of device_register() failure, but the problem in this code is more
vast.

We need to set bus->state to UNMDIOBUS_REGISTERED before calling
device_register() to correctly release the device in mdiobus_free().
This patch prevents us from doing it, since in case of device_register()
failure put_device() will be called 2 times and it will cause UAF or
something else.

Also, Reported-by: tag in revered commit was wrong, since syzbot
reported different leak in same function.

Link: https://lore.kernel.org/netdev/20210928092657.GI2048@kadam/
Acked-by: Yanfei Xu <yanfei.xu@windriver.com>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/f12fb1faa4eccf0f355788225335eb4309ff2599.1633024062.git.paskripkin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-09-30 17:11:58 -07:00
..
2021-08-03 13:05:26 +01:00
2021-07-03 11:13:22 -07:00
2021-07-27 20:11:44 +01:00
2021-06-30 15:51:09 -07:00
2021-09-01 08:44:42 -07:00
2021-09-17 13:52:17 +01:00
2021-07-27 20:11:44 +01:00
2021-07-27 20:11:44 +01:00
2021-07-27 20:11:43 +01:00
2021-06-28 12:44:17 -07:00
2021-07-27 20:11:45 +01:00
2021-08-04 10:10:12 +01:00
2021-07-27 20:11:44 +01:00
2021-08-03 13:05:26 +01:00
2021-07-29 12:18:12 +01:00