diff options
author | Zenghui Yu | 2021-07-27 10:52:31 +0800 |
---|---|---|
committer | Kalle Valo | 2021-08-29 14:44:57 +0300 |
commit | b63aed3ff195130fef12e0af590f4838cf0201d8 (patch) | |
tree | 83a21667fa4b292dc20cb3895e2a24f252b9f658 /drivers/bcma/host_soc.c | |
parent | aee7c86a61c7b846ece6ee462a1145f2a209f24c (diff) |
bcma: Fix memory leak for internally-handled cores
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: ab54bc8460b5 ("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
Diffstat (limited to 'drivers/bcma/host_soc.c')
0 files changed, 0 insertions, 0 deletions