kbuffer: Update kbuf->next in kbuffer_refresh

If the kbuffer was read to completion, the kbuf->curr would equal both the
size and kbuf->next. The kbuffer_refresh() is to update the kbuf if more
data was added to the buffer. But if curr is at the end, the next pointer
was not updated, which is incorrect. The next pointer needs to be moved to
the end of the newly written event.

Update the pointers in kbuffer_refresh() just as if it was loaded new (but
still keeping curr at the correct location).

Link: https://lore.kernel.org/linux-trace-devel/20240108151437.3c23a4f9@gandalf.local.home

Fixes: 7a4d5b24 ("kbuffer: Add kbuffer_refresh() API")
Reported-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 file changed