Re: [PATCH 05/10] remoteproc: imx_rproc: Avoid stale mailbox pointers on request failure
From: Lee Jones
Date: Thu Nov 26 2026 - 04:16:32 EST
On Wed, 25 Nov 2026, Richard Leitner wrote:
> On Wed, Nov 25, 2026 at 07:23:37AM +0100, Richard Leitner wrote:
> > Hi Lee, Hi Peng,
> >
> > On Tue, Nov 24, 2026 at 11:23:41AM +0800, Peng Fan (OSS) wrote:
> > > Hi Lee,
> > > On Mon, 23 Nov 2026 17:20:49 +0000 Lee Jones <lee@xxxxxxxxxx> wrote:
> > >
> > > > imx_rproc_xtr_mbox_init() stores the result of
> > > > mbox_request_channel_byname() directly into priv->tx_ch and priv->rx_ch.
> > > > Because mailbox channels are freed on stop() and detach() and
> > > > re-requested on start(), attach(), and system shutdown, a failure while
> > > > requesting "tx" leaves an ERR_PTR in priv->tx_ch, which is later
> > > > dereferenced by imx_rproc_kick() and imx_rproc_free_mbox(). If "rx"
> > > > fails after "tx" succeeds, priv->tx_ch is freed without being cleared
> > > > while priv->rx_ch retains an ERR_PTR, causing subsequent calls to see
> > > > both pointers as non-NULL and skip initialisation, leading to a
> > > > use-after-free on priv->tx_ch and an ERR_PTR dereference on priv->rx_ch.
> > > >
> > > > Request both channels into local variables and assign priv->tx_ch and
> > > > priv->rx_ch only after both requests succeed.
> > >
> > > I think Richard Leitner <richard.leitner@xxxxxxxxx> is working on this.
> > >
> > > https://lore.kernel.org/linux-remoteproc/CANLsYkx=M_TXN10qAcQC0be065TYnzfOae6E8ss-9DTj9MzogA@xxxxxxxxxxxxxx/T/#ma2f8e4c332d47e5bdd1787f82f4dd2feeafc67d6
> >
> > AFAICT my series fixes a similar, but other problem. Mine is about the
> > free'ing order and a possible race when a kick occurs during
> > cleanup/close. This one is targeted towards the setup/initialisation.
> > Therefore IMHO this is a valid, fix for a different problem than mine.
> >
> > What's your opinion on this Lee?
>
> Sorry, was too quick with answering and messed up things, as this fixes the
> sashiko finding, not the "my" initial bug. So for me it's fine if we keep
> this one, as I have not sended mine yet. ;-)
>
> Therefore please feel free to add:
>
> Reviewed-by: Richard Leitner <richard.leitner@xxxxxxxxx>
Thank you Richard.
--
Lee Jones