android_kernel_xiaomi_sm7250/drivers/mcb
Dan Carpenter 66f74ba9be mcb: fix error handling in mcb_alloc_bus()
commit 25a1433216489de4abc889910f744e952cb6dbae upstream.

There are two bugs:
1) If ida_simple_get() fails then this code calls put_device(carrier)
   but we haven't yet called get_device(carrier) and probably that
   leads to a use after free.
2) After device_initialize() then we need to use put_device() to
   release the bus.  This will free the internal resources tied to the
   device and call mcb_free_bus() which will free the rest.

Fixes: 5d9e2ab9fe ("mcb: Implement bus->dev.release callback")
Fixes: 18d2881980 ("mcb: Correctly initialize the bus's device")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johannes Thumshirn <jth@kernel.org>
Link: https://lore.kernel.org/r/32e160cf6864ce77f9d62948338e24db9fd8ead9.1630931319.git.johannes.thumshirn@wdc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-06 15:31:12 +02:00
..
Kconfig mcb: Added support for LPC or non PCI based MCB carrier 2016-08-31 13:16:24 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mcb-core.c mcb: fix error handling in mcb_alloc_bus() 2021-10-06 15:31:12 +02:00
mcb-internal.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mcb-lpc.c MCB: add support for SC31 to mcb-lpc 2017-08-31 18:49:41 +02:00
mcb-parse.c mcb: Fix an error handling path in 'chameleon_parse_cells()' 2017-08-31 18:49:41 +02:00
mcb-pci.c mcb: add Altera PCI ID to mcb-pci 2018-03-14 19:13:48 +01:00