]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - arch/x86/events/intel/core.c
perf/x86/intel: Fix memory corruption
[thirdparty/kernel/stable.git] / arch / x86 / events / intel / core.c
index 3d77c736299f37ac8c808c67bdf94af0f3b130e2..db5c769d34ea2127415d0b2bc227d151b2e4c59a 100644 (file)
@@ -3398,7 +3398,7 @@ tfa_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
        /*
         * Without TFA we must not use PMC3.
         */
-       if (!allow_tsx_force_abort && test_bit(3, c->idxmsk)) {
+       if (!allow_tsx_force_abort && test_bit(3, c->idxmsk) && idx >= 0) {
                c = dyn_constraint(cpuc, c, idx);
                c->idxmsk64 &= ~(1ULL << 3);
                c->weight--;