linux-stable/drivers/mailbox
Yang Yingliang a39b4de080 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>
2023-01-14 10:16:12 +01:00
..
arm_mhu.c
arm_mhu_db.c
armada-37xx-rwtm-mailbox.c
bcm-flexrm-mailbox.c mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg 2022-10-26 13:25:40 +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:40:41 +02:00
Kconfig
mailbox-altera.c
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:21:18 +02:00
mailbox.h
Makefile
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 2023-01-14 10:16:12 +01:00