[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20221117171146.63ac85f2@gandalf.local.home>
Date: Thu, 17 Nov 2022 17:11:46 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Daniil Tatianin <d-tatianin@...dex-team.ru>
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org,
yc-core@...dex-team.ru
Subject: Re: [PATCH v1] kernel/trace/ring_buffer: don't deactivate
non-existant pages
On Mon, 14 Nov 2022 17:31:29 +0300
Daniil Tatianin <d-tatianin@...dex-team.ru> wrote:
> 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.
>
> Signed-off-by: Daniil Tatianin <d-tatianin@...dex-team.ru>
> ---
> kernel/trace/ring_buffer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index a12e27815555..1e9de3d49701 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -1635,9 +1635,9 @@ static void rb_free_cpu_buffer(struct ring_buffer_per_cpu *cpu_buffer)
>
> free_buffer_page(cpu_buffer->reader_page);
>
> - rb_head_page_deactivate(cpu_buffer);
> -
Logically, this should never happen, but regardless, I consider this a fix.
Queued. Thanks Daniil!
-- Steve
> if (head) {
> + rb_head_page_deactivate(cpu_buffer);
> +
> list_for_each_entry_safe(bpage, tmp, head, list) {
> list_del_init(&bpage->list);
> free_buffer_page(bpage);
Powered by blists - more mailing lists