Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mailbox: zynqmp: Fix counts of child nodes

If child mailbox node status is disabled it causes
crash in interrupt handler. Fix this by assigning
only available child node during driver probe.

Fixes: 4981b82ba2ff ("mailbox: ZynqMP IPI mailbox controller")
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230311012407.1292118-2-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

authored by

Tanmay Shah and committed by
Mathieu Poirier
f72f805e 408ec1ff

+6 -1
+6 -1
drivers/mailbox/zynqmp-ipi-mailbox.c
··· 634 634 struct zynqmp_ipi_mbox *mbox; 635 635 int num_mboxes, ret = -EINVAL; 636 636 637 - num_mboxes = of_get_child_count(np); 637 + num_mboxes = of_get_available_child_count(np); 638 + if (num_mboxes == 0) { 639 + dev_err(dev, "mailbox nodes not available\n"); 640 + return -EINVAL; 641 + } 642 + 638 643 pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes), 639 644 GFP_KERNEL); 640 645 if (!pdata)