Re: [RFC PATCH] coresight: dynamic-replicator: Fix handling of multiple connections

From: Stephen Boyd
Date: Thu Apr 09 2020 - 03:17:03 EST


Quoting Suzuki K Poulose (2020-04-08 15:43:47)
> On Tue, Apr 07, 2020 at 08:48:54PM +0530, Sai Prakash Ranjan wrote:
> >
> > Thanks, I can test it out.
>
> Please find the untested patch below.
>
> ---8>---
>
> [untested] coresight: Fix support for sparse port numbers
>
> On some systems the firmware may not describe all the ports
> connected to a component (e.g, for security reasons). This
> could be especially problematic for "funnels" where we could
> end up in modifying memory beyond the allocated space for
> refcounts.
>
> e.g, for a funnel with input ports listed 0, 3, 5, nr_inport = 3.
> However the we could access refcnts[5] while checking for
> references.
>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
> ---

Things don't blow up for me anymore with KASAN, so feel free to add

Tested-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>