Message ID | 20230907122820.0899019c@gandalf.local.home (mailing list archive) |
---|---|
State | Accepted |
Commit | 95a404bd60af6c4d9d8db01ad14fe8957ece31ca |
Headers | show |
Series | ring-buffer: Do not attempt to read past "commit" | expand |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 72ccf75defd0..a1651edc48d5 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -2390,6 +2390,11 @@ rb_iter_head_event(struct ring_buffer_iter *iter) */ commit = rb_page_commit(iter_head_page); smp_rmb(); + + /* An event needs to be at least 8 bytes in size */ + if (iter->head > commit - 8) + goto reset; + event = __rb_page_index(iter_head_page, iter->head); length = rb_event_length(event);