kernel_optimize_test/drivers/mailbox
Sudeep Holla a3592fa49d mailbox: arm_mhu_db: Fix mhu_db_shutdown by replacing kfree with devm_kfree
[ Upstream commit 9905f728b0bda737fe2c2afd7c24f3365a45cc7b ]

The mhu_db_channel info is allocated per channel using devm_kzalloc from
mhu_db_mbox_xlate which gets called from mbox_request_channel. However
we are releasing the allocated mhu_db_channel info using plain kfree from
mhu_db_shutdown which is called from mbox_free_channel.

This leads to random crashes when the channel is freed like below one:

  Unable to handle kernel paging request at virtual address 0080000400000008
  [0080000400000008] address between user and kernel address ranges
  Internal error: Oops: 96000044 [#1] PREEMPT SMP
  Modules linked in: scmi_module(-)
  CPU: 1 PID: 2212 Comm: rmmod Not tainted 5.10.0-rc5 #31
  Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno
  	Development Platform, BIOS EDK II Nov 19 2020
  pstate: 20000085 (nzCv daIf -PAN -UAO -TCO BTYPE=--)
  pc : release_nodes+0x74/0x230
  lr : devres_release_all+0x40/0x68
  Call trace:
   release_nodes+0x74/0x230
   devres_release_all+0x40/0x68
   device_release_driver_internal+0x12c/0x1f8
   driver_detach+0x58/0xe8
   bus_remove_driver+0x64/0xe0
   driver_unregister+0x38/0x68
   platform_driver_unregister+0x1c/0x28
   scmi_driver_exit+0x38/0x44 [scmi_module]
   __arm64_sys_delete_module+0x188/0x260
   el0_svc_common.constprop.0+0x80/0x1a8
   do_el0_svc+0x2c/0x98
   el0_sync_handler+0x160/0x168
   el0_sync+0x174/0x180
  Code: 1400000d eb07009f 54000460 f9400486 (f90004a6)
  ---[ end trace c55ffd306c140233 ]---

Fix it by replacing kfree with devm_kfree as required.

Fixes: 7002ca237b ("mailbox: arm_mhu: Add ARM MHU doorbell driver")
Reported-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-30 11:53:28 +01:00
..
arm_mhu_db.c mailbox: arm_mhu_db: Fix mhu_db_shutdown by replacing kfree with devm_kfree 2020-12-30 11:53:28 +01:00
arm_mhu.c mailbox: arm_mhu: Match only if compatible is "arm,mhu" 2020-10-12 21:10:34 -05:00
armada-37xx-rwtm-mailbox.c mailbox:armada-37xx-rwtm:remove duplicate print in armada_37xx_mbox_probe() 2020-03-19 23:00:32 -05:00
bcm-flexrm-mailbox.c maillbox: bcm-flexrm-mailbox: handle cmpl_pool dma allocation failure 2020-03-19 23:00:32 -05:00
bcm-pdc-mailbox.c mailbox: bcm: convert tasklets to use new tasklet_setup() API 2020-10-12 21:10:34 -05:00
bcm2835-mailbox.c
hi3660-mailbox.c
hi6220-mailbox.c mailbox: no need to set .owner platform_driver_register 2019-11-26 22:45:15 -06:00
imx-mailbox.c mailbox: imx: Mark PM functions as __maybe_unused 2020-08-03 23:28:36 -05:00
Kconfig mailbox: Add support for Qualcomm IPCC 2020-05-30 18:43:23 -05:00
mailbox-altera.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
mailbox-sti.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
mailbox-test.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
mailbox-xgene-slimpro.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
mailbox.c mailbox: avoid timer start from callback 2020-10-16 19:09:17 -05:00
mailbox.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Makefile mailbox: arm_mhu: Add ARM MHU doorbell driver 2020-10-12 21:10:34 -05:00
mtk-cmdq-mailbox.c maiblox: mediatek: Fix handling of platform_get_irq() error 2020-10-12 21:10:34 -05:00
omap-mailbox.c mailbox: Replace HTTP links with HTTPS ones 2020-08-03 23:24:43 -05:00
pcc.c mailbox: pcc: Put the PCCT table for error path 2020-08-03 23:25:19 -05:00
pl320-ipc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
platform_mhu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
qcom-apcs-ipc-mailbox.c mailbox: qcom: Add msm8994 apcs compatible 2020-08-03 23:31:34 -05:00
qcom-ipcc.c mailbox: Add support for Qualcomm IPCC 2020-05-30 18:43:23 -05:00
rockchip-mailbox.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
sprd-mailbox.c mailbox: sprd: Add Spreadtrum mailbox driver 2020-05-30 18:05:33 -05:00
stm32-ipcc.c mailbox: stm32-ipcc: Update wakeup management 2019-11-30 23:08:59 -06:00
sun6i-msgbox.c mailbox: sun6i-msgbox: Add a new mailbox driver 2020-03-19 23:00:32 -05:00
tegra-hsp.c firmware: tegra: Enable BPMP support on Tegra234 2020-09-18 15:57:04 +02:00
ti-msgmgr.c mailbox: Replace HTTP links with HTTPS ones 2020-08-03 23:24:43 -05:00
zynqmp-ipi-mailbox.c mailbox: zynqmp-ipi: Fix NULL vs IS_ERR() check in zynqmp_ipi_mbox_probe() 2020-05-30 18:08:40 -05:00