[PATCH] powerpc/fsl-rio: Fix fsl_rio_setup error paths and use-after-unmap

Gang.Liu at freescale.com Gang.Liu at freescale.com
Wed Apr 30 12:58:07 EST 2014


> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Wednesday, April 30, 2014 1:13 AM
> To: Liu Gang-B34182
> Cc: linuxppc-dev at lists.ozlabs.org
> Subject: Re: [PATCH] powerpc/fsl-rio: Fix fsl_rio_setup error paths and
> use-after-unmap
> 
> On Mon, 2014-04-28 at 23:04 -0500, Liu Gang-B34182 wrote:
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Tuesday, April 29, 2014 9:32 AM
> > > To: linuxppc-dev at lists.ozlabs.org
> > > Cc: Wood Scott-B07421; Liu Gang-B34182
> > > Subject: [PATCH] powerpc/fsl-rio: Fix fsl_rio_setup error paths and
> > > use- after-unmap
> > >
> > > Several of the error paths from fsl_rio_setup are missing error
> messages.
> > >
> > > Worse, fsl_rio_setup initializes several global pointers and does
> > > not NULL them out after freeing/unmapping on error.  This caused
> > > fsl_rio_mcheck_exception() to crash when accessing rio_regs_win
> > > which was non-NULL but had been unmapped.
> > >
> > > Signed-off-by: Scott Wood <scottwood at freescale.com>
> > > Cc: Liu Gang <Gang.Liu at freescale.com>
> > > ---
> > > Liu Gang, are you sure all of these error conditions are fatal?  Why
> > > does the rio driver fail if rmu is not present (e.g.  on t4240)?
> >
> > Hi Scott, I think the errors you modified in the patch are serious and
> > should be fixed. Thanks very much!
> > And in fact, the rio driver can be used just for the submodule of the
> SRIO: RMU.
> > It should be used with arch/powerpc/sysdev/fsl_rmu.c and there should
> > have the RMU module.
> > The fsl_rio.c implements some basic and needed works to support the RMU
> running well.
> 
> I don't quite follow -- is it expected that rio can work without rmu, or
> not?  As is, fsl_rio_setup() will error out if it doesn't find an
> fsl,srio-rmu-handle property.

fsl_rio_setup() doesn't expect that rio can work without rmu. All the rio
drivers just has one purpose, it's rmu. But rmu is a submodule of the rio,
so the driver should parse rio in dtb and finish some initial works first,
and then to setup rmu.
That's why the drivers cannot just have a such as rmu_setup() to parse
fsl,srio-rmu-handle property.

Thanks,
Liu Gang
 


More information about the Linuxppc-dev mailing list