]> git.baikalelectronics.ru Git - kernel.git/commit
driver: base: fix UAF when driver_attach failed
authorSchspa Shi <schspa@gmail.com>
Fri, 13 May 2022 11:24:44 +0000 (19:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2022 17:28:42 +0000 (19:28 +0200)
commit8891ad5f0e24f4b21f2c6dc941468ce7e8f961dc
tree1c2c74d10a8273d9c654441c8919dbc8287a1d7b
parent2a43a19d7441d2ae7b6823977d4172eb34d78494
driver: base: fix UAF when driver_attach failed

When driver_attach(drv); failed, the driver_private will be freed.
But it has been added to the bus, which caused a UAF.

To fix it, we need to delete it from the bus when failed.

Fixes: f3219bce1941 ("driver core: fix possible missing of device probe")
Signed-off-by: Schspa Shi <schspa@gmail.com>
Link: https://lore.kernel.org/r/20220513112444.45112-1-schspa@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/bus.c