mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mailbox: Remove redundant mbox_controller_unregister() on probe failure
@ 2026-10-06 10:59 Anup Vishwakarma
  2026-10-06 10:59 ` [PATCH v2 1/2] mailbox: qcom-ipcc: " Anup Vishwakarma
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anup Vishwakarma @ 2026-10-06 10:59 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Jassi Brar, Huang Yiwei, Sudeep Holla
  Cc: Jassi Brar, linux-arm-msm, linux-kernel, Anup Vishwakarma, Mukesh Ojha

Changes in v2:
- Remove now-empty err_req_irq: label in qcom-ipcc.c (patch 1/2)
- Restore original alignment of devm_request_threaded_irq() arguments
  in arm_mhu_db.c (patch 2/2)

Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
---
Changes in v2:
- Link to v1: https://patch.msgid.link/20261006-b4-mbox_double_unregister_fix-v1-0-9011ca208d36@oss.qualcomm.com

To: Manivannan Sadhasivam <mani@kernel.org>
To: Jassi Brar <jassisinghbrar@gmail.com>
To: Huang Yiwei <quic_hyiwei@quicinc.com>
To: Sudeep Holla <sudeep.holla@kernel.org>
Cc: Jassi Brar <jaswinder.singh@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

---
Anup Vishwakarma (2):
      mailbox: qcom-ipcc: Remove redundant mbox_controller_unregister() on probe failure
      mailbox: arm_mhu_db: Remove redundant mbox_controller_unregister() on probe failure

 drivers/mailbox/arm_mhu_db.c | 4 +---
 drivers/mailbox/qcom-ipcc.c  | 5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)
---
base-commit: bf1ee2bd5c2da8992f33c8950ef194aaff74ed6c
change-id: 20261006-b4-mbox_double_unregister_fix-42d5057d3ad5

Best regards,
--  
Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] mailbox: qcom-ipcc: Remove redundant mbox_controller_unregister() on probe failure
  2026-10-06 10:59 [PATCH v2 0/2] mailbox: Remove redundant mbox_controller_unregister() on probe failure Anup Vishwakarma
@ 2026-10-06 10:59 ` Anup Vishwakarma
  2026-10-06 10:59 ` [PATCH v2 2/2] mailbox: arm_mhu_db: " Anup Vishwakarma
  2026-10-12  1:32 ` [PATCH v2 0/2] mailbox: " Jassi Brar
  2 siblings, 0 replies; 4+ messages in thread
From: Anup Vishwakarma @ 2026-10-06 10:59 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Jassi Brar, Huang Yiwei, Sudeep Holla
  Cc: Jassi Brar, linux-arm-msm, linux-kernel, Anup Vishwakarma, Mukesh Ojha

qcom_ipcc_probe() registers the mailbox controller via
devm_mbox_controller_register(), which automatically calls
mbox_controller_unregister() through devres when the device is removed
or probe fails. If devm_request_irq() subsequently fails, the
err_req_irq: label also manually calls mbox_controller_unregister(),
resulting in a double call that corrupts the global mailbox controller
list and causes a kernel panic.

Remove the redundant manual call and rely on devres for cleanup.

Fixes: e9d50e4b4d04 ("mailbox: qcom-ipcc: Dynamic alloc for channel arrangement")
Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 drivers/mailbox/qcom-ipcc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index 185b63f724d4..b301cefe4954 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -329,15 +329,12 @@ static int qcom_ipcc_probe(struct platform_device *pdev)
 			       IRQF_TRIGGER_HIGH | IRQF_NO_SUSPEND |
 			       IRQF_NO_THREAD, name, ipcc);
 	if (ret < 0)
-		goto err_req_irq;
+		goto err_mbox;
 
 	platform_set_drvdata(pdev, ipcc);
 
 	return 0;
 
-err_req_irq:
-	if (ipcc->num_chans)
-		mbox_controller_unregister(&ipcc->mbox);
 err_mbox:
 	irq_domain_remove(ipcc->irq_domain);
 

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] mailbox: arm_mhu_db: Remove redundant mbox_controller_unregister() on probe failure
  2026-10-06 10:59 [PATCH v2 0/2] mailbox: Remove redundant mbox_controller_unregister() on probe failure Anup Vishwakarma
  2026-10-06 10:59 ` [PATCH v2 1/2] mailbox: qcom-ipcc: " Anup Vishwakarma
@ 2026-10-06 10:59 ` Anup Vishwakarma
  2026-10-12  1:32 ` [PATCH v2 0/2] mailbox: " Jassi Brar
  2 siblings, 0 replies; 4+ messages in thread
From: Anup Vishwakarma @ 2026-10-06 10:59 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Jassi Brar, Huang Yiwei, Sudeep Holla
  Cc: Jassi Brar, linux-arm-msm, linux-kernel, Anup Vishwakarma, Mukesh Ojha

mhu_db_probe() registers the mailbox controller via
devm_mbox_controller_register(), which automatically calls
mbox_controller_unregister() through devres when the device is removed
or probe fails. If devm_request_threaded_irq() subsequently fails in
the channel setup loop, the error path also manually calls
mbox_controller_unregister(), resulting in a double call that corrupts
the global mailbox controller list and causes a kernel panic.

Remove the redundant manual call and rely on devres for cleanup.

Fixes: 7002ca237b21 ("mailbox: arm_mhu: Add ARM MHU doorbell driver")
Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
 drivers/mailbox/arm_mhu_db.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mailbox/arm_mhu_db.c b/drivers/mailbox/arm_mhu_db.c
index a39239e38a47..9f1c7bcfdcb4 100644
--- a/drivers/mailbox/arm_mhu_db.c
+++ b/drivers/mailbox/arm_mhu_db.c
@@ -317,10 +317,8 @@ static int mhu_db_probe(struct amba_device *adev, const struct amba_id *id)
 		err = devm_request_threaded_irq(dev, irq, NULL,
 						mhu_db_mbox_rx_handler,
 						IRQF_ONESHOT, "mhu_db_link", mhu);
-		if (err) {
-			mbox_controller_unregister(&mhu->mbox);
+		if (err)
 			return err;
-		}
 	}
 
 	dev_info(dev, "ARM MHU Doorbell mailbox registered\n");

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] mailbox: Remove redundant mbox_controller_unregister() on probe failure
  2026-10-06 10:59 [PATCH v2 0/2] mailbox: Remove redundant mbox_controller_unregister() on probe failure Anup Vishwakarma
  2026-10-06 10:59 ` [PATCH v2 1/2] mailbox: qcom-ipcc: " Anup Vishwakarma
  2026-10-06 10:59 ` [PATCH v2 2/2] mailbox: arm_mhu_db: " Anup Vishwakarma
@ 2026-10-12  1:32 ` Jassi Brar
  2 siblings, 0 replies; 4+ messages in thread
From: Jassi Brar @ 2026-10-12  1:32 UTC (permalink / raw)
  To: Anup Vishwakarma
  Cc: Manivannan Sadhasivam, Huang Yiwei, Sudeep Holla, Jassi Brar,
	linux-arm-msm, linux-kernel, Mukesh Ojha

On Tue, Oct 6, 2026 at 5:59 AM Anup Vishwakarma
<anup.vishwakarma@oss.qualcomm.com> wrote:
>
> Changes in v2:
> - Remove now-empty err_req_irq: label in qcom-ipcc.c (patch 1/2)
> - Restore original alignment of devm_request_threaded_irq() arguments
>   in arm_mhu_db.c (patch 2/2)
>
> Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
> ---
> Changes in v2:
> - Link to v1: https://patch.msgid.link/20261006-b4-mbox_double_unregister_fix-v1-0-9011ca208d36@oss.qualcomm.com
>
> To: Manivannan Sadhasivam <mani@kernel.org>
> To: Jassi Brar <jassisinghbrar@gmail.com>
> To: Huang Yiwei <quic_hyiwei@quicinc.com>
> To: Sudeep Holla <sudeep.holla@kernel.org>
> Cc: Jassi Brar <jaswinder.singh@linaro.org>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
>
> ---
> Anup Vishwakarma (2):
>       mailbox: qcom-ipcc: Remove redundant mbox_controller_unregister() on probe failure
>       mailbox: arm_mhu_db: Remove redundant mbox_controller_unregister() on probe failure
>
>  drivers/mailbox/arm_mhu_db.c | 4 +---
>  drivers/mailbox/qcom-ipcc.c  | 5 +----
>  2 files changed, 2 insertions(+), 7 deletions(-)
> ---
> base-commit: bf1ee2bd5c2da8992f33c8950ef194aaff74ed6c
> change-id: 20261006-b4-mbox_double_unregister_fix-42d5057d3ad5
>
> Best regards,
> --
> Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
>
Applied to mailbox/for-next

Thanks
Jassi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-12  1:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 10:59 [PATCH v2 0/2] mailbox: Remove redundant mbox_controller_unregister() on probe failure Anup Vishwakarma
2026-10-06 10:59 ` [PATCH v2 1/2] mailbox: qcom-ipcc: " Anup Vishwakarma
2026-10-06 10:59 ` [PATCH v2 2/2] mailbox: arm_mhu_db: " Anup Vishwakarma
2026-10-12  1:32 ` [PATCH v2 0/2] mailbox: " Jassi Brar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®