Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72c2ea34 authored by Daniil Tatianin's avatar Daniil Tatianin Committed by Greg Kroah-Hartman
Browse files

ring_buffer: Do not deactivate non-existant pages

commit 56f4ca0a79a9f1af98f26c54b9b89ba1f9bcc6bd upstream.

rb_head_page_deactivate() expects cpu_buffer to contain a valid list of
->pages, so verify that the list is actually present before calling it.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.

Link: https://lkml.kernel.org/r/20221114143129.3534443-1-d-tatianin@yandex-team.ru



Cc: stable@vger.kernel.org
Fixes: 77ae365e ("ring-buffer: make lockless")
Signed-off-by: default avatarDaniil Tatianin <d-tatianin@yandex-team.ru>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f715f315
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1362,9 +1362,9 @@ static void rb_free_cpu_buffer(struct ring_buffer_per_cpu *cpu_buffer)

	free_buffer_page(cpu_buffer->reader_page);

	if (head) {
		rb_head_page_deactivate(cpu_buffer);

	if (head) {
		list_for_each_entry_safe(bpage, tmp, head, list) {
			list_del_init(&bpage->list);
			free_buffer_page(bpage);