Re: [PATCH v9 06/10] usb: dwc3: qcom: Add support to read IRQ's related to multiport
From: Johan Hovold
Date: Wed Jul 12 2023 - 08:12:37 EST
On Wed, Jun 21, 2023 at 10:06:24AM +0530, Krishna Kurapati wrote:
> Add support to read Multiport IRQ's related to quad port controller
> of SA8295 Device.
>
> Signed-off-by: Krishna Kurapati <quic_kriskura@xxxxxxxxxxx>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 108 +++++++++++++++++++++++++++++------
> 1 file changed, 91 insertions(+), 17 deletions(-)
> +static int dwc3_qcom_setup_mp_irq(struct platform_device *pdev)
> +{
> + struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
> + char irq_name[15];
The interrupt device-name string can not be allocated on the stack or
reused as it is stored directly in each irqaction structure.
This can otherwise lead to random crashes when accessing
/proc/interrupts:
https://lore.kernel.org/lkml/ZK6IV_jJPICX5r53@xxxxxxxxxxxxxxxxxxxx/
> + int irq;
> + int ret;
> + int i;
> +
> + for (i = 0; i < 4; i++) {
> + if (qcom->dp_hs_phy_irq[i])
> + continue;
> +
> + sprintf(irq_name, "dp%d_hs_phy_irq", i+1);
> + irq = dwc3_qcom_get_irq(pdev, irq_name, -1);
> + if (irq > 0) {
> + irq_set_status_flags(irq, IRQ_NOAUTOEN);
> + ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
> + qcom_dwc3_resume_irq,
> + IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> + irq_name, qcom);
> + if (ret) {
> + dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret);
> + return ret;
> + }
> + }
> +
> + qcom->dp_hs_phy_irq[i] = irq;
> + }
Johan