linux-imx/drivers/bus/fsl-mc
Ioana Ciornei 79afd0939b bus: fsl-mc: fix double-free on mc_dev
The blamed commit tried to simplify how the deallocations are done but,
in the process, introduced a double-free on the mc_dev variable.

In case the MC device is a DPRC, a new mc_bus is allocated and the
mc_dev variable is just a reference to one of its fields. In this
circumstance, on the error path only the mc_bus should be freed.

This commit introduces back the following checkpatch warning which is a
false-positive.

WARNING: kfree(NULL) is safe and this check is probably not required
+       if (mc_bus)
+               kfree(mc_bus);

Fixes: a042fbed02 ("staging: fsl-mc: simplify couple of deallocations")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2023-11-07 12:40:54 +02:00
..
dpbp.c bus: fsl-mc: remove duplicated include files 2018-12-06 15:53:20 +01:00
dpcon.c bus: fsl-mc: remove duplicated include files 2018-12-06 15:53:20 +01:00
dpmcp.c bus: fsl-mc: change mc_command in fsl_mc_command 2018-03-23 15:52:48 +01:00
dprc-driver.c bus: fsl-mc: use common cleanup function in DPRC .remove() op 2023-10-30 19:10:14 +02:00
dprc.c bus: fsl-mc: dprc: Fix a couple of misspelling and formatting issues 2021-06-17 13:44:32 +02:00
fsl-mc-allocator.c bus: fsl-mc: drop useless cleanup 2023-10-30 19:10:13 +02:00
fsl-mc-bus.c bus: fsl-mc: fix double-free on mc_dev 2023-11-07 12:40:54 +02:00
fsl-mc-msi.c bus: Explicitly include correct DT includes 2023-08-12 10:31:01 +02:00
fsl-mc-private.h bus: fsl-mc: drop useless cleanup 2023-10-30 19:10:13 +02:00
fsl-mc-uapi.c bus: fsl-mc: add the dprc_get_mem() command to the whitelist 2023-10-30 19:10:12 +02:00
Kconfig genirq: Get rid of GENERIC_MSI_IRQ_DOMAIN 2022-11-17 15:15:20 +01:00
Makefile bus/fsl-mc: Add generic implementation for open/reset/close commands 2021-09-28 16:56:05 -06:00
mc-io.c bus: fsl-mc: mc-io: Correct misdocumentation of 'dpmcp_dev' param 2021-06-17 13:44:33 +02:00
mc-sys.c bus: fsl-mc: increase MC_CMD_COMPLETION_TIMEOUT_MS value to 15s 2023-10-30 19:10:12 +02:00
obj-api.c bus/fsl-mc: Add generic implementation for open/reset/close commands 2021-09-28 16:56:05 -06:00