WSL2-Linux-Kernel/drivers/mailbox
Yang Yingliang 4f05d8e2fb mailbox: zynq-ipi: fix error handling while device_register() fails
[ Upstream commit a6792a0cde ]

If device_register() fails, it has two issues:
1. The name allocated by dev_set_name() is leaked.
2. The parent of device is not NULL, device_unregister() is called
   in zynqmp_ipi_free_mboxes(), it will lead a kernel crash because
   of removing not added device.

Call put_device() to give up the reference, so the name is freed in
kobject_cleanup(). Add device registered check in zynqmp_ipi_free_mboxes()
to avoid null-ptr-deref.

Fixes: 4981b82ba2 ("mailbox: ZynqMP IPI mailbox controller")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:14:39 +01:00
..
Kconfig
Makefile
arm_mhu.c
arm_mhu_db.c
arm_mhuv2.c mailbox: arm_mhuv2: Fix return value check in mhuv2_probe() 2022-12-31 13:14:39 +01:00
armada-37xx-rwtm-mailbox.c
bcm-flexrm-mailbox.c mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg 2022-10-26 12:35:21 +02:00
bcm-pdc-mailbox.c
bcm2835-mailbox.c
hi3660-mailbox.c
hi6220-mailbox.c
imx-mailbox.c mailbox: imx: fix wakeup failure from freeze mode 2022-04-08 14:24:10 +02:00
mailbox-altera.c
mailbox-mpfs.c mailbox: mpfs: read the system controller's status 2022-12-31 13:14:39 +01:00
mailbox-sti.c
mailbox-test.c
mailbox-xgene-slimpro.c
mailbox.c mailbox: forward the hrtimer if not queued and under a lock 2022-06-09 10:23:12 +02:00
mailbox.h
mtk-cmdq-mailbox.c
omap-mailbox.c
pcc.c
pl320-ipc.c
platform_mhu.c
qcom-apcs-ipc-mailbox.c
qcom-ipcc.c
rockchip-mailbox.c
sprd-mailbox.c
stm32-ipcc.c
sun6i-msgbox.c
tegra-hsp.c
ti-msgmgr.c
zynqmp-ipi-mailbox.c mailbox: zynq-ipi: fix error handling while device_register() fails 2022-12-31 13:14:39 +01:00