[PATCH] serial: mxs-auart: fix probe error paths and clock handling
Rosen Penev
rosenp at gmail.com
Sat May 30 12:33:32 PDT 2026
On Sat, May 30, 2026 at 3:25 AM Greg Kroah-Hartman
<gregkh at linuxfoundation.org> wrote:
>
> On Thu, May 28, 2026 at 04:06:16PM -0700, Rosen Penev wrote:
> > Sashiko reported three pre-existing bugs in the mxs-auart driver:
> >
> > - For non-ASM9260 variants, mxs_get_clks() obtained the clock but never
> > prepared/enabled it, leaving register accesses in probe at risk of
> > faulting if the bootloader had gated the clock.
> > - The error path and remove function used pdev->id instead of
> > s->port.line to clear the auart_port[] slot. For DT-probed devices
> > pdev->id is -1, causing an out-of-bounds write and leaving a dangling
> > pointer in the array.
>
> This feels like it should be a different patch, and not burried in this
> change, right?
>
> > - The probe error path called iounmap() while the IRQ was still
> > registered. An interrupt during that window would dereference the
> > unmapped membase.
> >
> > All of this is a consequence of using mixed devm and non devm. Instead
> > of working around these issues, go full devm so that everything can be
> > cleaned up properly.
>
> Are you sure that devm and irq code is going to work properly? That's
> always a very tricky code path, was this tested with the hardware to
> ensure it still works on teardown correctly?
Nope. v2 incoming.
>
> thanks,
>
> greg k-h
More information about the linux-arm-kernel
mailing list