Files
twx-linux/drivers
Zenghui Yu 743a3ee388 bcma: Fix memory leak for internally-handled cores
[ Upstream commit b63aed3ff1 ]

kmemleak reported that dev_name() of internally-handled cores were leaked
on driver unbinding. Let's use device_initialize() to take refcounts for
them and put_device() to properly free the related stuff.

While looking at it, there's another potential issue for those which should
be *registered* into driver core. If device_register() failed, we put
device once and freed bcma_device structures. In bcma_unregister_cores(),
they're treated as unregistered and we hit both UAF and double-free. That
smells not good and has also been fixed now.

Fixes: ab54bc8460 ("bcma: fill core details for every device")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210727025232.663-2-yuzenghui@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-22 11:47:55 +02:00
..
…
2021-09-22 11:47:50 +02:00
…
…
…
…
…
…
…
2021-07-20 16:15:55 +02:00
…
…
2021-09-22 11:47:54 +02:00
…
…
…
…
…
…
…
…
…
2021-08-26 08:36:46 -04:00
…
…
…
…
…
…
2021-09-22 11:47:51 +02:00
…
…
…
…
…
…
…
…