coresight: Fixes for v6.4

Couple of fixes for coresight self-hosted tracing subsystem for v6.4.
 These include :
   - Fix signedness bug in tmc_etr_buf_insert_barrier_packet()
   - Fix memory leak with failing to release the path if trace-id allocation fails
 
 Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEuFy0byloRoXZHaWBxcXRZPKyBqEFAmRdCqEACgkQxcXRZPKy
 BqFDJRAAkOcvPAWg83ZHb7DRKBaMRj6ujvDQg35MaDJtc3JoUvTxU3ui9zlfEj0c
 BM57vc3cTkRgvTCeZCR9O/Vl30gPQVSL80oM18vXOWudaMNo1FAOCT7BTPjU4AnI
 nWszBvfLbgXZOfHFTaQH4XCdpwZDAgPHsqgmP/Xo2KZWmbEDsKKA7MfmXBP2rgdN
 IPgjBRvTA9znlbYzv3ETs9aHEfDbRK3dPmPZYfmsx7J6AM6v1pKTFdxVA98fNfVI
 G4iXmA16oa/flN8Due4OxLN1Et7c72WJ0CoptjnaccWUC+NKs8TdKZ3PwzLDRyln
 2n9SsETfHnL2uqg1bGkmylk8QMVqL0KPDTZy/AvOOYYMARuJKUn7lCSJvhQbFsm/
 hYE8kDPcuBy/Z9LBNbnrkC8luUWhlz9sO/XKaF1H7wh7ooz+X7WE+sTizPWzLsO7
 xBRCIZFjsJ8JWZt2AD2q2Fa1FVaTiyUefN9ecPTj9C1vFcuyn8flAzZAwk9De3xX
 0B/mWK0TYdUfSbBtLZHlZEl85POwmoQqG7Bk+EB6u6+cpVRuFHmB/BTA9khspiG8
 UCCzNBhOXoTaMpbZwDLbewjitkaawqk8i+DMuZ6UXAnEWpotHMZRManZTUYIeZj0
 gZW9f96A5WYg1XI33tvjgcReXxiRUCyLIDzjkTeClEqE+MWzb0E=
 =iR0E
 -----END PGP SIGNATURE-----

Merge tag 'coresight-fixes-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux into char-misc-linus

Suzuki writes:

coresight: Fixes for v6.4

Couple of fixes for coresight self-hosted tracing subsystem for v6.4.
These include :
  - Fix signedness bug in tmc_etr_buf_insert_barrier_packet()
  - Fix memory leak with failing to release the path if trace-id allocation fails

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

* tag 'coresight-fixes-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux:
  coresight: perf: Release Coresight path when alloc trace id failed
  coresight: Fix signedness bug in tmc_etr_buf_insert_barrier_packet()
This commit is contained in:
Greg Kroah-Hartman 2023-05-13 20:16:46 +09:00
commit 000dcaa5c0
2 changed files with 2 additions and 1 deletions

View File

@ -402,6 +402,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
trace_id = coresight_trace_id_get_cpu_id(cpu);
if (!IS_VALID_CS_TRACE_ID(trace_id)) {
cpumask_clear_cpu(cpu, mask);
coresight_release_path(path);
continue;
}

View File

@ -942,7 +942,7 @@ tmc_etr_buf_insert_barrier_packet(struct etr_buf *etr_buf, u64 offset)
len = tmc_etr_buf_get_data(etr_buf, offset,
CORESIGHT_BARRIER_PKT_SIZE, &bufp);
if (WARN_ON(len < CORESIGHT_BARRIER_PKT_SIZE))
if (WARN_ON(len < 0 || len < CORESIGHT_BARRIER_PKT_SIZE))
return -EINVAL;
coresight_insert_barrier_packet(bufp);
return offset + CORESIGHT_BARRIER_PKT_SIZE;