Re: [PATCH] perf/x86/intel/uncore: Fix IIO cleanup mapping procedure for SNR/ICX

From: Peter Zijlstra
Date: Wed Jul 07 2021 - 07:44:47 EST


On Tue, Jul 06, 2021 at 10:12:55AM -0400, Liang, Kan wrote:
>
>
> On 7/6/2021 5:07 AM, alexander.antonov@xxxxxxxxxxxxxxx wrote:
> > From: Alexander Antonov <alexander.antonov@xxxxxxxxxxxxxxx>
> >
> > Cleanup mapping procedure for IIO PMU is needed to free memory which was
> > allocated for topology data and for attributes in IIO mapping
> > attribute_group.
> > Current implementation of this procedure for Snowridge and Icelake Server
> > platforms doesn't free allocated memory that can be a reason for memory
> > leak issue.
> > Fix the issue with IIO cleanup mapping procedure for these platforms
> > to release allocated memory.
> >
> > Fixes: 10337e95e04c ("perf/x86/intel/uncore: Enable I/O stacks to IIO PMON mapping on ICX")
> >
> > Signed-off-by: Alexander Antonov <alexander.antonov@xxxxxxxxxxxxxxx>
>
> The patch looks good to me.
>
> Reviewed-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>

Thanks!

---
Subject: perf/x86/intel/uncore: Fix IIO cleanup mapping procedure for SNR/ICX
From: Alexander Antonov <alexander.antonov@xxxxxxxxxxxxxxx>
Date: Tue, 06 Jul 2021 12:07:23 +0300

From: Alexander Antonov <alexander.antonov@xxxxxxxxxxxxxxx>

skx_iio_cleanup_mapping() is re-used for snr and icx, but in those
cases it fails to use the appropriate XXX_iio_mapping_group and as
such fails to free previously allocated resources, leading to memory
leaks.

Fixes: 10337e95e04c ("perf/x86/intel/uncore: Enable I/O stacks to IIO PMON mapping on ICX")
Signed-off-by: Alexander Antonov <alexander.antonov@xxxxxxxxxxxxxxx>
[peterz: Changelog]
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Link: https://lore.kernel.org/r/20210706090723.41850-1-alexander.antonov@xxxxxxxxxxxxxxx
---