Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Linkai Gong <gonglinkai@kylinos.cn>
Cc: Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	Shawn Guo <shawnguo@kernel.org>,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware: imx: dsp: fix mailbox channel leak on kasprintf failure
Date: Thu, 13 Aug 2026 11:40:52 -0500	[thread overview]
Message-ID: <an3zlEsHUnFbjQsD@SMW015318> (raw)
In-Reply-To: <20260813095818.2275666-1-gonglinkai@kylinos.cn>

On Thu, Aug 13, 2026 at 05:58:18PM +0800, Linkai Gong wrote:
> [You don't often get email from gonglinkai@kylinos.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> If kasprintf() fails while setting up mailbox channels, already
> requested channels from earlier iterations were never freed. Route
> the failure through the existing cleanup path.
>
> Fixes: ffbf23d50353 ("firmware: imx: Add DSP IPC protocol interface")
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/firmware/imx/imx-dsp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c
> index ed79e823157a..7e3f45ddf0c1 100644
> --- a/drivers/firmware/imx/imx-dsp.c
> +++ b/drivers/firmware/imx/imx-dsp.c
> @@ -99,8 +99,10 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc)
>                 else
>                         chan_name = kasprintf(GFP_KERNEL, "rxdb%d", i - 2);
>
> -               if (!chan_name)
> -                       return -ENOMEM;
> +               if (!chan_name) {
> +                       ret = -ENOMEM;
> +                       goto out;
> +               }
>
>                 dsp_chan = &dsp_ipc->chans[i];
>                 dsp_chan->name = chan_name;
> --
> 2.25.1
>


      reply	other threads:[~2026-08-13 16:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  9:58 [PATCH] firmware: imx: dsp: fix mailbox channel leak on kasprintf failure Linkai Gong
2026-08-13 16:40 ` Frank Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=an3zlEsHUnFbjQsD@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=daniel.baluta@nxp.com \
    --cc=festevam@gmail.com \
    --cc=gonglinkai@kylinos.cn \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox