Re: [PATCH 6.12 117/337] tracing/mmiotrace: Add NULL check for mmio_trace_array in logging functions
Steven Rostedt <[email protected]>
| Newsgroups | dev.linux.lists.patches,org.kernel.vger.stable |
|---|---|
| Message-ID | <20260808182247.39dc80fc@robin> |
On Sat, 8 Aug 2026 22:53:31 +0530 Harshit Mogalapalli <[email protected]> wrote: > I ran an AI-assisted backport review and then checked the 6.12.y code. I > think this backport is missing a small prerequisite. > > Upstream's wrappers pass tr directly to __trace_mmiotrace_rw() and > __trace_mmiotrace_map().Each function checks tr before dereferencing it: > > if (!tr) > return; > buffer = tr->array_buffer.buffer; > > > The upstream fix follows commit: 6936298393d8 ("tracing/mmiotrace: > Remove reference to unused per CPU data pointer"), which removes the > unused data argument. > > 6.12.y does not have that commit, so both functions still have that > argument and their wrappers compute it first: > > struct trace_array *tr = mmio_trace_array; > struct trace_array_cpu *data = > per_cpu_ptr(tr->array_buffer.data, smp_processor_id()); > __trace_mmiotrace_rw(tr, data, rw); > > > Consequently, if mmio_trace_array is NULL, the dereference in > per_cpu_ptr(tr->array_buffer.data, ...) occurs before either function's > new NULL check. > > I think 6.12.y needs commit: 6936298393d8 ("tracing/mmiotrace: Remove > reference to unused per CPU data pointer") before this fix. > > Thoughts? > Yeah, it looks like the kernel could crash for the same reasons without commit 6936298393d8. Greg, care to backport that one too? Thanks, -- Steve